Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package zuhaib;
- import java.io.*;
- import java.util.*;
- public class labtest1 {
- public static void main(String[] args) {
- List<Integer> l = new ArrayList<Integer>();
- PrintStream out = System.out;
- Scanner sc = new Scanner (System.in);
- out.println("Enter values by ENTERING");
- for (int i = sc.nextInt();i>=0; i = sc.nextInt())
- {
- int p = sc.nextInt();
- l.add(new Integer );
- }
- Iterator it = l.iterator ();
- out.println(l.get(2));
- /*int num=0;
- for (;it.hasNext();)
- {
- num = num+(l.get());
- }
- out.println(num);*/
- }
- }
- can please take a look and tell me what is wrong why its not adding list's elements? thank you
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement