wood burning stoves
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Generics Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Generics Doubt" Watch "Generics Doubt" New topic
Author

Generics Doubt

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 751
Hi guys! Is this declaration perfectly legal? Thanks!

List<Integer> ls1 = new LinkedList();


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1710

Hi guys! Is this declaration perfectly legal? Thanks!

List<Integer> ls1 = new LinkedList();


Hi Sam,

Yeah that is legal, but with compile time warning. ls1 is typesafe reference variable of List parameterized with Integer and on the right hand
side you are creating non type safe LinkedList;

Assigning unsafe object to typesafe reference variable gives compiler warning.



Regards,
cmbhatt


cmbhatt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generics Doubt
 
It's not a secret anymore!