File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

vector and integer

Suka Hati
Ranch Hand

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


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)

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

Joined: Oct 02, 2003
Posts: 166
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

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

"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:
subject: vector and integer
It's not a secret anymore!