• Post Reply Bookmark Topic Watch Topic
  • New Topic

adding elements into a List  RSS feed

 
Peng Fan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why jvm complains about the following code? how to bypass such case?
 
Yosi Hendarsjah
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the message?
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That code compiles fine. Can you post the error message you are getting?
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
missing or incorrect import?
Did you perhaps import java.awt.List instead of java.util.List?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To be clear, the JVM and the compiler are two different beasts.

Neither my compiler nor my JVM have any complaints about the posted code.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!