javaclassintellij-ideainterface

IntelliJ IDEA 'class' or 'interface' expected


public class StudentApp {
    public static void main(String[] args) {
        Student student1 = new Student("test");
        Student student2 = new Student("test","test");
        System.out.println(student2.getId());
    }
}

The constructor looks like this:

public Student(String firstName, String lastName){
        this.id=nextId++;
        this.name = firstName+" "+lastName;
    }

The first argument of student2 is saying "'class' or 'interface' expected" but it compiles and runs just fine. What may be the error here?


Solution

  • Go to the Language Injections page: Editor | Language Injections and uncheck or delete the injection created by IDE.