So I'm not sure why the following code returns "They're not equal". From inspection it should return "They're equal". Can anyone help me out? Thank you in advance.
public class BenAndLiam {
public static void main(String[] args){
    String[] name = new String[2];
    name[0] = "Liam";
    name[1] = "Short";
    int[] marks = new int[3];
    marks[0] = 90;
    marks[1] = 50;
    marks[2] = 70;
    //make students
    Student Liam = new Student(1111, name, marks);
    Student Ben = new Student(1111, name, marks);
    //print Liam's info
    System.out.println(Liam.getId() + " " + Liam.getName()[0] + " " + 
    Liam.getName()[1] + " " + Liam.getMarks()[0] + " " + Liam.getMarks()[1] +
    " " + Liam.getMarks()[2]);
    System.out.println(Ben.getId() + " " + Ben.getName()[0] + " " + 
            Ben.getName()[1] + " " + Ben.getMarks()[0] + " " + Ben.getMarks()[1] +
            " " + Ben.getMarks()[2]);
    //check for equality
    if(Ben.equals(Liam))
        System.out.println("They're equal");
    else System.out.println("They're not equal");
    }
}
My code for student:
public class Student {
//The aspects of a student
private int id;
private String name[];
private int marks[];
//Constructor 1
public Student(int id, String name[]){
    this.id = id;
    this.name = name;
}
//Constructor 2
public Student(int id, String name[], int marks[]){
    setId(id);
    setName(name);
    setMarks(marks);
}
//accessor for id
public int getId(){
    return id;
}
//accessor for name
public String getName()[]{
    return name;
}
//accessor for marks
public int getMarks()[]{
    return marks;
}
//Mutator for id
public void setId(int id){
    this.id = id;
}
//mutator for name
public void setName(String name[]){
    this.name = name;
}
//Mutator for marks
public void setMarks(int marks[]){
    this.marks = marks;
}
}
By the looks of things I need to have some sort of heading for the use of equals() in my Student class?
UPDATE: I just got it working by adding this code into my Student class:
public boolean equals(Student otherstudent){
    return ((id == otherstudent.id) && (name.equals(otherstudent.name)
            && (marks == otherstudent.marks)));
}
Cheers guys!
 
     
     
     
     
     
     
    