the code I am currently trying:
public static void main(String[] args) throws IOException {
String content = new Scanner(new File("test/input_file.txt")).useDelimiter("\\z").next();
System.out.println(content);
String room = content.substring(0,3);
System.out.println("room size:");
System.out.println(room);
}
I want to read each data line of data, and be able to use them, eg. the first line is 10, I want to be able to create a variable to store it, but if the first line is 9, my code would not be working since I am using the substring.
So, How can I read the file, and put the data in multiple variables? such as I want to read the first line and store it in a variable named room, read the second line, and store it as firstcoordinate_x, and firstcoordinate_y.
substringif the line is just one thing anyway?substring, how can I get the data in the first line?