• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

error please help

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how do i convert or create a dynamic array as a String?
 
Keith Lynn
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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().
 
reply
    Bookmark Topic Watch Topic
  • New Topic