I was going all over the internet looking for something to help me with this problem. I learned how to make an arrayList, but i want to know how to make it acceptable user input. What i mean by that is that i want the user to input his number. Here is what i have:
public class MyClass {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
ArrayList<Integer> myList=new ArrayList<Integer>(10);
System.out.println("Enter your number:");
myList.add(416355);
myList.add(21212);
for(int x : myList)
System.out.println(x);
System.out.println("Size="+myList.size());
}
}
What i have now is the numbers i have put in there. Any help is greatly appreciated.
Thanks in advance.