Sword 5 Shield 5 10 Cake Sword 7 Shield 1 5
I need to read from a file and as I'm reading I need to know if the line read was a Sword, Shield or a Cake. Depending on what the item is I will do different things with it. It is important to know the numbers that follow the item. For example, shields have 2 ints, but swords only 1 int. The ints are the stats of the item.
Scanner read = new Scanner(new File("inventory.txt")) ;
while (read.hasNext())
{
infile.findInLine("Shield") ;
}
Please, help me.