Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unchecked call to add E as a member of rawtype JDK 1.5.0._09

807599Nov 23 2006 — edited Nov 23 2006
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 21 2006
Added on Nov 23 2006
5 comments
768 views