Here is the code I wrote :
try {
String[] Flight_Inputs = null;
Scanner in = new Scanner(f); // f = input file
int counter =0;
while(in.hasNextLine()) {
Flight_Inputs[counter++] = in.next();
//Flight_Inputs = in.nextLine().split("\n"); // Also tried this
}
in.close();
for(int i = 0,j=0; i < Flight_Inputs.length; i++){
Boeing.setDestination_from(Flight_Inputs[j++]);
Boeing.setDestination_to(Flight_Inputs[j++]);
Boeing.setName(Flight_Inputs[j++]);
}
I am getting Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException error I tried also other variations and got an error that I was trying to access index 1 of Flight_Inputs but compiler says it doesnt exist.
What I want to do do is simply get some lines from the text file and assign them to variables of Boieng object... Any help would be appreciated!