Multiple choice technology programming languages

import java.util.*; class GFC113 { public static void main (String[] args) { Object m = new LinkedHashSet(); System.out.print((m instanceof Collection)+","); System.out.print((m instanceof Set)+","); System.out.print(m instanceof HashSet); }} What is the result of attempting to compile and run the program?

  1. Prints: false,false,false

  2. Prints: false,true,false

  3. Prints: true,false,true

  4. Prints: true,true,true

  5. None of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

LinkedHashSet extends HashSet, which implements Set, which in turn extends Collection. Therefore, an instance of LinkedHashSet is an instance of Collection, Set, and HashSet, making all three instanceof checks evaluate to true.