my code is like this
and my txt file is like this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | public void load() throws Exception { File inputFile = new File( "a.txt" ); Scanner input = new Scanner( "a.txt" ); int num; boolean state; while (input.hasNext()) { int a = input.nextInt(); startPerson = a; } input.close(); } |
1
0 6 true 2 1 false
0 5 false 6 1 false
0 5 true 4 2 false
0 4 false 2 0 false
0 4 false 5 2 false
0 3 false 3 2 false
0 3 false 1 0 false
0 2 true 1 2 false
0 2 false 0 1 false
0 1 false 4 1 false
0 1 false 7 0 false
0 0 false 0 0 false
0 0 true 4 0 false
0 0 false 3 1 false
How can I read the first int as the "int startperson"that i decide before
second and third to be another thing, each "false" can be used to be boolean type
As this is a save, the lines in the txt files will be varied every time. How can I get the number of the lines on the text file?
Thank you