Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes setting a string from a Vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "setting a string from a Vector" Watch "setting a string from a Vector" New topic
Author

setting a string from a Vector

Patrick Mallahan
Ranch Hand

Joined: Apr 22, 2005
Posts: 69
I am trying to do:



but it keeps giving me the error:



can you not pull a string from a vector and put it into another string?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

There's no method "getString()" or "getString(String)" in Vector. If item 27 in a Vector is known to be a String, you can say

String temp = (String) names.get(27);

But I'm not sure what you're trying to do with the String "employee_name"; is that intended to be an argument to a method of some object that's in the Vector?


[Jess in Action][AskingGoodQuestions]
Patrick Mallahan
Ranch Hand

Joined: Apr 22, 2005
Posts: 69
i am trying to compare two objects from seperate methods.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Originally posted by Patrick Mallahan:
i am trying to compare two objects from seperate methods.


If you can explain in a little more detail what exactly is in the vector, and what you want to do, I'm sure we can help you figure this out.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: setting a string from a Vector
 
Similar Threads
error when testing...any help will be appreciated
is this statement correct?
Passing a recordset to a class
Adding elements to a vector
invalid character constant