Multiple choice technology programming languages

class c1{ public static void main(String a[]) { c1 ob1=new c1(); Object ob2=ob1; System.out.println(ob2 instanceof Object); System.out.println(ob2 instanceof c1); } } What is the result of attempting to compile and run the program?

  1. Prints true,false

  2. Print false,true

  3. Prints true,true

  4. compile time error

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

ob2 references the same object as ob1, which is an instance of c1. Therefore ob2 instanceof Object is true and ob2 instanceof c1 is also true, giving the output true true. The stored answer matches this result.