Not sure what is going wrong on line 24. I'm trying to override the Object.equals() method, but since that method takes type Object, I want to filter out inputs that are not an instance of Employee. This is for an intro java course
I'm getting these errors:
4 errors found:
File: /Users/wesley/Documents/Employee.java  [line: 24]
Error: ')' expected
File: /Users/wesley/Documents/Employee.java  [line: 24]
Error: variable declaration not allowed here
File: /Users/wesley/Documents/Employee.java  [line: 24]
Error: ';' expected
File: /Users/wesley/Documents/Employee.java  [line: 30]
Error: 'else' without 'if'
Here's the code.
//employee number, name, and salary
public class Employee{
  private String name;
  private final int ID;
  private double salary;
  private static int lastID;
  public Employee(String name, double salary){
    this.name=name;
    ID=Employee.lastID+1;
    this.salary=salary;
    Employee.lastID=Employee.lastID+1;
  } 
  public String getName(){return name;}
  public int getID(){ return ID; }
  public double getSalary(){ return salary;}
  public void setName(String newName){name=newName;}
  public void raise(double newSalary){ salary=newSalary;}
  @Override
  public String toString(){
    return "Name: "+ getName() + "\nID: " + getID() + "\nSalary: " + getSalary();
  }
  @Override
  public boolean equals(Object o){
    if(o instanceOf Employee){//errors are here!
    Employee input=(Employee) o;
    if(this.getSalary()==input.getSalary() && this.getName().equals(input.getName())){
      return true;
    }
  }
    else{return false;
    }//another error here
      }
    }
Can't be bothered to fix the indentation. Just happened when I pasted stuff in
 
     
    