BufferedReader - reading in a line
I am trying to store each line of the file "fixtures.txt" as a String in the array fixtures[]. I have used a similar method in a different class, but for some reason it won't read, it just keeps throwing the exception.
publicvoid getUpcomingFixtures(){
String line ="";
int n = 0 ;
try{
File fixturesFile =new File("home/andy/1/Project/src/fixtures.txt") ;
FileReader fixturesFileReader =new FileReader(fixturesFile) ;
BufferedReader fixtureIn =new BufferedReader(fixturesFileReader) ;
n = 0 ;
while ( ( line = fixtureIn.readLine() ) !=null ){
fixtures[n] = line ;
n++ ;
}
fixtureList.setListData( fixtures ) ;// update list with fixtures
}catch (Exception e){ e.printStackTrace() ;}
}
i also tried it with the following change (assuming "fixtures.txt" is 20 lines long)
while ( n < 20 ){
line = fixtureIn.readLine()
fixtures[n] = line ;
n++ ;
}
It's probably a simple mistake, as I am reusing code from another class. Can anyone help me please?
Thanks

