Hi there.
I am attempting to get this code to run from a command window but keep getting the unchecked call warning. Although, this is just a warning - the class file is not being created. ??
Any ideas on how I can overcome this?
This needs to run in version 5.
import java.util.Scanner;
import java.util.ListIterator;
import java.util.ArrayList;
class program
{
public static void main(String arg[])
{
int integer;
/* Scanner class object created */
Scanner reader = new Scanner(System.in);
/* ArrayList object created */
ArrayList list = new ArrayList(4);
for(int i=0; i<4; i++)
{
/* reading integer from user */
System.out.print("Enter an integer: ");
integer = reader.nextInt();
/* adding each integer in ArrayList */
list.add(new Integer(integer));
}
/* listiterator to traverse the list */
ListIterator itr = list.listIterator();
/* displaying the elements of ArrayList */
System.out.println("\nValues contained in ArrayList");
while(itr.hasNext())
{
System.out.println(itr.next());
}
}
}
Thanks