简体   繁体   中英

How do I fix compilation error: identifier expected

I keep get error.How do I fix this?

The error message is in the bottom.

Here is my code:

public class AirTicketProcessor {

private ArrayList<AirTicket> airTickets 
    = new ArrayList<AirTicket>();
private ArrayList<AirTicket> airTicketsOriginal
    = new ArrayList<AirTicket>();
private ArrayList<String> invalidRecords
    = new ArrayList<String>();
 
public AirTicketProcessor() {
}

public void addAirTicket(AirTicket() tickets) {
 tickets = AirTicket().copyOf(tickets, tickets.length + 1);
 tickets[ticket.slength - 1] = newTicket; 
}
}

AirTicketProcessor.java:123: error: <identifier> expected
public void addAirTicket(AirTicket() tickets) {
                                  ^ 

The error you're getting means the code doesn't comply with the syntax rules of the Java language.

The syntax should be like this: public void addAirTicket(AirTicket tickets)

By including the () after AirTickets , you are telling the compiler to invoke a function called AirTickets . It is not looking for a function call in the typing of your parameter list.

You should be able to fix this error simply by removing the ()

Try: public void addAirTicket(AirTicket tickets) {

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM