File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes vector and integer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "vector and integer" Watch "vector and integer" New topic
Author

vector and integer

Suka Hati
Ranch Hand

Joined: Oct 28, 2004
Posts: 56
i have below coding

outputDuration.addElement(cubaan);

cubaan is integer. outputDuration is a vector. when i tried to compile this coding i got error

addElement(java.lang.Object) in java.util.Vector cannot be applied to (int)
outputDuration.addElement(cubaan);

how to solve this error???can anybody help me
Yosi Hendarsjah
Ranch Hand

Joined: Oct 02, 2003
Posts: 164
Look at the API docs for java.util.Vector. The method's parameter type is Object. You can wrap cubaan with java.lang.Integer.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9052
    
  12
An 'int' is not an Object. You need to change your int to an Object before you can store it in a Vector.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: vector and integer