I have a text file, that I'm supposed to read data from. The data should then be used to set a level to pass:
- > 20 → very good
- between 12-20 → OK
- < 12 → failed
The .txt file looks like this
X;20
Y;12
The problem is, that when I read from the file, and add it to an ArrayList, it only reads the columns. In other words, the result is that index 0 contains X;Y, and index 1 contains 20;12. What I need is for index 0 to contain [X 20] and index 1 to contain [Y 12].
My code is:
BufferedReader assignment = new BufferedReader(new FileReader(assignmentFile));
ArrayList<String> assignmentArrayList = new ArrayList<String>();
String item;
while ((item = assignment.readLine()) != null) {
assignmentArrayList.add(item);
String[] itemSplit = item.split(";");
String passWithDistinction = itemSplit[0];
String pass = itemSplit[1];
System.out.println(passWithDistinction + pass);
}
Stringarray?