الرجوع
تسجيل الدخول

What is the output?

public class Student {
    private String id;
    private String name;

    public Student(String id, String name) {
        this.id = id;
        this.name = name;
    }

    public boolean hasSameId(Student other) {
        return this.id.equals(other.id);
    }

    public static void main(String[] args) {
        Student s1 = new Student("A123", "Alice");
        Student s2 = new Student("A123", "Bob");
        System.out.println(s1.hasSameId(s2);
    }
}