• 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

Problems faced in returning String array

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



When returning this array, i got error as variable might not have been initialized., can anyone Please help me how to solve this.........


[HENRY: Added Code Tags]
[ June 08, 2008: Message edited by: Henry Wong ]
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First of all, UseCodeTags. It will make it easier for people to read.

As for your error, it is not in the code you have provided. I have copied this, declared videoCrytoLineA and videoCrytoLineB as private fields (which I assume they are) and compiled. Worked like a charm. Can you post the entire error message? Something like what I got when I removed the import for StringTokenizer:



On a side note, you have made one huge logical error in the following two lines:

The toString() method of StringBuffer (and StringBuilder) returns a new String object with the current contents of the StringBuffer. This String has no connection to the StringBuffer at all. Therefore, when you update the StringBuffer, the String will not change!

You should move these two lines to the end, just before you return the array, as that's the first point where the StringBuffers will no longer be updated and their contents are final.

Oh, and this is a problem with Java in General, so that's where this thread is moving.
[ June 08, 2008: Message edited by: Rob Prime ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic