• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generics question?

 
Gary Kevin
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Henry Wong
author
Marshal
Pie
Posts: 21420
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmmm.... Line 3 should compile fine. There doesn't seem to be anything wrong with it.

Henry
 
Wim Molenberghs
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21420
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good point. I too, was just focused on the generics part.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic