Jdk6 vs Jdk7.0 - Cast from Object type to Primitive type.

12 views
Skip to first unread message

ksp, A java geek

unread,
Jan 3, 2014, 12:18:17 PM1/3/14
to java...@googlegroups.com

Casting from Object Type to Primitive Type is valid in Jdk7.0.  It is invalid in Java 6 (Line 3 error).

ArrayList groups= new ArrayList();
groups.add(Integer.valueOf(10));
int gid= (int)groups.get(0);
System.out.println("Group id" + gid);

 

Reply all
Reply to author
Forward
0 new messages