-3
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 处的信号。

有什么建议么?

4

2 回答 2

1

您需要告诉参数是什么类型:

public static Vehicle[] fillArray(String inputString) throws Exception

否则编译器不知道inputString是字符串、int 还是其他对象。它不会通过名字来猜测。

于 2013-10-17T21:49:16.613 回答
0

您应该为您的参数指定一个类型。尝试这个 :

public static Vehicle[] fillArray(String inputString) throws exception
于 2013-10-17T21:49:06.617 回答