I’m having problems reading in a text file with java. The text file has the following format:
String
String
String
String
Int
Int
Int
Int
With each String and int value having a new line character at the end and a blank line in between the stings and ints. I want to save each string value into a string array but I can’t quite figure out how to get the scanner to stop at the blank line. I tried various methods such as going until there is an int, going until the value of hasNext is ” “, and trying to just read the strings but nothing is working. Can someone provide anyhelp?
Not sure from your example if you have exactly 4
Strings and 4Integers or more, so something like the following should work: