Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

AP CSA Question of the Day March 12, 2025

Reference
  1. Incorrect Correct No Answer was selected Invalid Answer

    Given:

    Person.java

    public class Person {
        String name;
    
        public Person(String name) {
            this.name = name;    
        }
    
        public boolean equals(Person person) {
            return name.equals(person.name);
        }
    }
    Java

    Main.java

    public class Main
    {
        public static void main(String[] args)
        {
            Person person1 = new Person("karel");
            Person person2 = new Person("karel");
        }
    }
    Java

    What is the value of the expression:

    person1 == person2
    Java