我的方法readDataFromFile()可以读取文本文件,例如:Bird Golden Eagle EddieMammal Tiger TommyMammal Lion LeoBird Parrot PollyReptile 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) ); }
添加回答
举报
0/150
提交
取消