• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with java input file

 
jonas okwara
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
//Please I need help with the code below. I want to be able to have different ".txt' files which corresponds to the name of a subject a user inputs in a dialog frame.



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);
}
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
jonas okwara
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am really greatful



Thx

jonas
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!