Hi I'm currently trying to extract data out of txt file then place it into a array. I would like to be able to use the array from another class but i cant seems to make it work after 6 hours. Can someone help me?

public String[] readSFile(int z) throws IOException{
BufferedReader br;
String [] anArray = new String[100];
br = new BufferedReader(new FileReader("students.txt"));
String s = null;
while(( s = br.readLine()) != null ){
anArray = s.split(";");


for (String str : anArray) {
System.out.println(str);
}
System.out.println();

}
br.close();
return anArray;
}

Another class. I'm actually trying to display it so i can actually choose what i want to display. Eg. extract names only, but the problem is when i enter 1? i was expecting anArray[1] to display :(
public static void main(String[] args) throws Exception {
StudentFile test = new StudentFile();
test.readSFile(1);
}
Thanks for reading :) Any help would be appreciated :)