aspose file tools*
The moose likes Beginning Java and the fly likes error please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "error please help" Watch "error please help" New topic
Author

error please help

catherine matthews
Ranch Hand

Joined: Jan 22, 2006
Posts: 78


i need add all the words within the dynamic array of arrV into aV..
But i get the following error when i complie ...

baseStablerun5.java:1828: cannot find symbol
symbol : constructor StringTokenizer(java.lang.Object)
location: class java.util.StringTokenizer
StringTokenizer words = new StringTokenizer(arrV.get(L));

why and how to solve this problem? please help...
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
When you have a Collection like ArrayList where you don't specify what type of objects are going to be stored, the reference type of the objects when you access them in the Collection will be Object. So you will have to convert what you retrieve from the ArrayList to a String before you try to do something with the elements that requires a String.
catherine matthews
Ranch Hand

Joined: Jan 22, 2006
Posts: 78
how do i convert or create a dynamic array as a String?
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Since toString() is inherited by all class definitions in Java, you can call toString() on any reference, however, depending on the type of object referred to, you may not get very useful information.

But if the objects in the ArrayList are Strings, you can get a reference to the String with toString().
 
 
subject: error please help