I have a class named student contains two variables name,no and i have created two objects for the class, now i want to check whether both objects are same or not. I am using .equals() method but i am not getting proper output.
public class Student {
String name;
int no;
Student(String name,int no){
this.name=name;
this.no=no;
}
public static void main(String[] args) {
Student s1 = new Student("abc", 10);
Student s2 = new Student("abc", 10);
System.out.println(s1.equals(s2));
}
}
output: false