aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes error unchecked call to addElement in vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "error unchecked call to addElement in vector" Watch "error unchecked call to addElement in vector" New topic
Author

error unchecked call to addElement in vector

Arun Maalik
Ranch Hand

Joined: Oct 25, 2005
Posts: 216


Dear sir when i am compiling above code then jvm showing an error message that java
warning [unchecked] unchecked call to addElement[E] as a memeber of raw type java.util
why sir what wrong with above code?

with regard

Arun kumar maalik
Aniket Patil
Ranch Hand

Joined: May 02, 2006
Posts: 218
As of Java 5.0, the class Vector has been parameterized, meaning that you need to indicate what type of element your Vector object will hold.

If you compile the above code using javac -source 1.4, no unchecked warning will be thrown. This is because generics do not exist in Java 1.4.

As you want to add a String to a Vector, in Java 5.0, this should be written as:


Perhaps you should go through generics first.
[ August 16, 2006: Message edited by: Aniket Patil ]

SCJP 5.0 | SCWCD 1.4 <br /> <br />If you don't know where you are going, any road will take you there!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: error unchecked call to addElement in vector