public static Vehicle[] fillArray(inputString) throws exception {
while(readRecords.ready()) {
Vehicle newVehicle;
checkType = readRecords.readLine();
if(checkType.equals("vehicle")) {
String ownersName = readRecords.readLine();
String address = readRecords.readLine();
String phone = readRecords.readLine();
String email = readRecords.readline();
newVehicle = new Vehicle(ownersName,address,phone,email);
list.add(newVehicle);
}
我得到<identifier> expected error
。在括号内的inputString处发信号。
有什么建议吗?
答案 0 :(得分:1)
您需要告诉参数的类型:
public static Vehicle[] fillArray(String inputString) throws Exception
否则编译器不知道inputString
是否是字符串,int或其他对象。它不会被名字猜测。
答案 1 :(得分:0)
您应该为参数指定类型。试试这个:
public static Vehicle[] fillArray(String inputString) throws exception