aspose file tools*
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
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: 746
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: 1707

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
 
Consider Paul's rocket mass heater.
 
subject: Generics Doubt