• Post Reply Bookmark Topic Watch Topic
  • New Topic

a warning message  RSS feed

 
Jude Fawly
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I am using jdk 1.6 and jre 1.6. Here when I use objects from collection, for example Vector class, I get warning at compile time saying that my Java file uses unchecked or unsafe operations.
The program is running, but I want to know the reason of this warning message if possible; it is out of curiousity.

Thanks.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generics was added in j2se 1.5
Here are a couple of lessons linked from the Swing Tutorial:
Lesson: Generics
Lesson: Generics
There is a sun forum dedicated to the subject.
 
Jude Fawly
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot.
 
Katrina Owen
Sheriff
Posts: 1367
18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to code without generics and compile without the 'unchecked' message, you could try compiling for 1.4 with the -source and -target flags



That error message drove me crazy until I discovered that it wasn't telling me that my code was wrong, just that I might be using references without checking that they were for the right type of object :-/
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!