I have a txt file like this
163 Money Drop 24
454 Happy 112
45 Nothing Without You 56
The first number is the id of the song which I want to store it as an integer, the second is a String !That is not one word! and the third is an integer which is the number of likes of the song. I want to store them in an array but when I use the scanner method I store them word by word and when a song has a name > 1 word I have a problem. Here's my testing code
public void readFile() {
while(x.hasNext()){
Song test = new Song(Integer.parseInt(x.next()), x.next(), Integer.parseInt(x.next()));
}
}
Is there any way I can read the txt file, store the first number as an int and then scan for the whole string(name of the song) until the next element is a number?