Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error please help

 
catherine matthews
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i convert or create a dynamic array as a String?
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic