Questions Related to technology

Multiple choice technology
  1. The equals method does NOT properly override the Object.equals method.

  2. Compilation fails because the private attribute p.name cannot be accessed in line 5.

  3. To work correctly with hash-based data structures, this class must also implement the hashCode method.

  4. When adding Person objects to a java.util.Set collection, the equals method in line 4 will prevent duplicates.

Reveal answer Fill a bubble to check yourself
A Correct answer
Multiple choice technology
  1. The equals method does NOT properly override the Object.equals method.

  2. Compilation fails because the private attribute p.name cannot be accessed in line 5.

  3. To work correctly with hash-based data structures, this class must also implement the hashCode method.

  4. When adding Person objects to a java.util.Set collection, the equals method in line 4 will prevent duplicates.

Reveal answer Fill a bubble to check yourself
A Correct answer
Multiple choice technology
  1. Object o = Old.get0(new LinkedList());

  2. Object o = Old.get0(new LinkedList<?>());

  3. String s = Old.get0(new LinkedList<String>());

  4. Object o = Old.get0(new LinkedList<Object>());

  5. String s = (String)Old.get0(new LinkedList<String>());

Reveal answer Fill a bubble to check yourself
A,D,E Correct answer