public static void main(String[] args) throws IOException{
String[] token = null;
int i, n = 0;
int lineCounter = 0;
Scanner file1 = new Scanner(new File(args[0]));
int[] lineNumber = new int[lineCounter];
for(i=0; i<lineCounter; i++) {
lineNumber[i] = n++;
}
String[] word = new String[lineCounter];
file1 = new Scanner(new File(args[0]));
while(file1.hasNextLine()) {
i++;
token[i] = file1.nextLine();
I keep trying to run the code, but it keeps giving me a null pointer exception. Any suggestions to fix this?
The token is referencing random words in a file called file1.