logo

Crowdly

Browser

Add to Chrome

What will happen here? class User {      private String name;      ...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

What will happen here?

class User { 

   

private String name; 

   

User(String name) { 

      this.name = name; 

   } 

  @Override 

  public boolean equals(Object obj) { 

    if (!(obj instanceof User)) return false; 

  

    User other = (User) obj; 

    return name.equals(other.name); 

  } 

Set users = new HashSet<>(); 

users.add(new User("Alex")); 

users.add(new User("Alex")); 

System.out.println(users.size());

100%
0%
0%
0%
More questions like this

Want instant access to all verified answers on moodle.inthergroup.com?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome