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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Generics question?" Watch "Generics question?" New topic
Author

Generics question?

Gary Kevin
Ranch Hand

Joined: Jul 24, 2006
Posts: 43
source:http://enigma.vm.bytemark.co.uk/webstart.html
John Meyers's SCJP 5 mock exam:question 31



What't the difference between line 2 and line 4?How to use for loop to get elements from type?


SCJP 5.0 72%
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18754
    
  40

Hmmmm.... Line 3 should compile fine. There doesn't seem to be anything wrong with it.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Wim Molenberghs
Greenhorn

Joined: Jan 31, 2008
Posts: 16
I think line 3 DOESN'T compile because it's not defined inside a method.
Line 1 and 2 are just classvariables.
[ May 10, 2008: Message edited by: Wim Molenberghs ]
Gary Kevin
Ranch Hand

Joined: Jul 24, 2006
Posts: 43
Originally posted by Wim Molenberghs:
I think line 3 DOESN'T compile because it's not defined inside a method.
Line 1 and 2 are just classvariables.

[ May 10, 2008: Message edited by: Wim Molenberghs ]


Wim:thinks,you got the point,my god,I just concentrate on the Generics problem too much and didn't aware of that.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18754
    
  40

Good point. I too, was just focused on the generics part.

Henry
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Generics question?