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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Generics ...." Watch "Generics ...." New topic
Author

Generics ....

kathir vel
Ranch Hand

Joined: Jul 03, 2007
Posts: 92
Hi All,
The mock exam says the following statement will compile.How can it compile?I tried in the pgm.But it is not compiling?Can anyone clarify me?Thanks.

List < ? > l = new ArrayList< Integer > ();
Prasad Tamirisa
Ranch Hand

Joined: Mar 26, 2007
Posts: 130
Originally posted by kathir vel:
But it is not compiling?Can anyone clarify me?Thanks.

List < ? > l = new ArrayList< Integer > ();



Well...kathir,

The preceeding code is perfectly compiling for me..! Check out once again.


Regards,
Durga Prasad
mo shaik
Greenhorn

Joined: Jul 17, 2007
Posts: 23
kathir vel
Ranch Hand

Joined: Jul 03, 2007
Posts: 92
Hi All,
In the exam it was using '<' and '>' for < and > symbols.I copied the same symbols in this post.But it is changed as normal symbols < and >.But I don't know why?I think in Sun Exam the generics type will always be inside < and > not with in '<' and '>'.
kathir vel
Ranch Hand

Joined: Jul 03, 2007
Posts: 92
Hi All,
In the exam it was using '<' and '>' for < and > symbols.I copied the same symbols in this post.But it is changed as normal symbols < and >.But I don't know why?I think in Sun Exam the generics type will always be inside < and > not with in '<' and '>'.
kathir vel
Ranch Hand

Joined: Jul 03, 2007
Posts: 92
Hi All,
In the exam it was using '& with lt' and '& with gt' for < and > symbols.I copied the same symbols in this post.But it is changed as normal symbols < and >.But I don't know why?I think in Sun Exam the generics type will always be inside < and > not with in '& with lt' and '& with gt'.
Manfred Klug
Ranch Hand

Joined: Jun 04, 2007
Posts: 377
Originally posted by kathir vel:
In the exam it was using '& with lt' and '& with gt' for < and > symbols.
< and > are special characters in HTML/XML. To avoid ambiguities you use '& with lt' and '& with gt'.

Originally posted by kathir vel:
I think in Sun Exam the generics type will always be inside < and > not with in '& with lt' and '& with gt'.
Yes.
Priyam Srivastava
Ranch Hand

Joined: Oct 29, 2006
Posts: 169
The mock exam says the following statement will compile.How can it compile?I tried in the pgm.But it is not compiling?Can anyone clarify me?Thanks.

List < ? > l = new ArrayList< Integer > ();


the code should compile assuming you are not trying to add something to the array list...


"History would be kind to me, for I intend to write it."
 
 
subject: Generics ....