I have to read some information from text file to different String arrays. So, I wrote a method for this task. Here is the code:
private String[] stateNames;
.
.
.
readHelper(stateNames);
.
.
.
private void readHelper( String[] str ) // str is stateNames
{
try
{
strLine = bufferReader.readLine();
String[] tokens = strLine.split(",");
str = new String[ tokens.length ];
copyStr2Str(tokens, str);
insertionSort( str ); // Everything is fine, str contains the data
}
catch (IOException ex)
{
Logger.getLogger(Generator.class.getName()).log(Level.SEVERE, null, ex);
}
} // End of readHelper()
However after readHelper() is executed stateNames becomes null. I think, I cause some pointer errors.