Please
I need help with this code. I want to be able to change "questionFile.txt" to correspond to the name of any file I input into the application.
try {
BufferedReader inputfile = new BufferedReader( new FileReader("questionFile.txt"));
for ( int i = 0; i < 3; i++){
question[i] = inputfile.readLine();
answer1[i] = inputfile.readLine();
answer2[i] = inputfile.readLine();
answer3[i] = inputfile.readLine();
answer4[i] = inputfile.readLine();
answer5[i] = inputfile.readLine();
}
inputfile.close();
}catch (IOException e) {
System.err.println(e);
System.exit(1);
}
I need help with this code. I want to be able to change "questionFile.txt" to correspond to the name of any file I input into the application.
try {
BufferedReader inputfile = new BufferedReader( new FileReader("questionFile.txt"));
for ( int i = 0; i < 3; i++){
question[i] = inputfile.readLine();
answer1[i] = inputfile.readLine();
answer2[i] = inputfile.readLine();
answer3[i] = inputfile.readLine();
answer4[i] = inputfile.readLine();
answer5[i] = inputfile.readLine();
}
inputfile.close();
}catch (IOException e) {
System.err.println(e);
System.exit(1);
}