Array Question
Can someone please help me with this code? I'm not to good with arrays yet, and I'm trying I can't figure out why this prints out a line of nulls. When I put the displayArray method within the for loop, it prints out the correct word values, but otherwise I get rows of nulls. Also, if there are any other obvious errors please fix. Thank you so much.
import java.io.*;
import java.util.*;
import java.text.*;
public class ZinniSpeech
{
private static String[] originalZinni;
private static Scanner rawText;
private static StringBuilder rawTextString;
private static StringTokenizer rawTextToken;
private static int wordTotal1;
private static int wordTotalFinal;
public static void main(String args[])throws IOException
{
rawText = new Scanner(new File(
"\\Java\\Zinni\\ZinniSpeechCDI5_04.txt"));
rawText.useDelimiter("\\W+");
rawTextString = new StringBuilder();
while(rawText.hasNext())
{
rawTextString.append(" " + rawText.next());
}
rawText.close();
rawTextToken = new StringTokenizer(rawTextString.toString());
wordTotal1 = rawTextToken.countTokens();
for (int x = 0; x < wordTotal1; x++)
{
String[] tempArray = new String[wordTotal1];
tempArray[x] = rawTextToken.nextToken();
if (!(tempArray[x].equals("")))
if (!(tempArray[x].equals("s")))
if (!(tempArray[x].equals("t")))
if (!(tempArray[x].equals("ve")))
if (!(tempArray[x].equals("re")))
if (!(tempArray[x].equals("m")))
if (!(tempArray[x].equals("ll")))
if (!(tempArray[x].equals("null")))
{
originalZinni = tempArray;
String lowerCase = new String(originalZinni[x]);
originalZinni[x] = lowerCase.toLowerCase();
}
}
displayList(tempArray);
}
private static void displayList(String[] originalZinni)
{
for(String word: originalZinni)
{
System.out.println(word);
}
}
}

