This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Problems faced in  returning String array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problems faced in  returning String array " Watch "Problems faced in  returning String array " New topic
Author

Problems faced in returning String array

Zibia Rajakumari
Greenhorn

Joined: Jun 08, 2008
Posts: 2



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 ]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19541
    
  16

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 ]

SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems faced in returning String array
 
Similar Threads
Problem faced in execution
Runtime Error - Need Help
Problems faced in returning String array
June Newsletter Puzzle
How can you do this