Two Laptop Bag
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
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: 9059
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!