| 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
|
 |
 |
|
|
subject: Generics Doubt
|
|
|