как новый линейный разделитель:
етодreadDataFromFile()
может читать текстовые файлы, такие как:
Bird Golden Eagle Eddie
Mammal Tiger Tommy
Mammal Lion Leo
Bird Parrot Polly
Reptile Cobra Colin
Первый столбец - «Тип» животного, второй - «Вид», а третий - «Имя».
Токовый выход:
Bird Golden Eagle < (Golden and Eagle count as different substrings).
Mammal Tiger Tommy
Mammal Lion Leo
Bird Parrot Polly
Reptile Cobra Colin
Как бы я использовалuseDelimiter
способ заставить 'беркут' считаться одним видом?Текущий код:
while(scanner.hasNextLine())
{
String type = scanner.next();
String species = scanner.next();
String name = scanner.next();
System.out.println(type + " " + species + " " + name);
scanner.nextLine();
addAnimal( new Animal(species, name, this) );
}