Multiple choice technology programming languages

What will happen when you attempt to compile and run the following code? interface MyInterface { } public class MyInstanceTest implements MyInterface { static String s; public static void main(String args[]) { MyInstanceTest t = new MyInstanceTest(); if(t instanceof MyInterface) { System.out.println("I am true interface"); } else { System.out.println("I am false interface"); } if(s instanceof String) { System.out.println("I am true String"); } else { System.out.println("I am false String"); } } }

  1. Prints : "I am false interface" followed by " I am false String"

  2. Prints : "I am true interface" followed by " I am true String"

  3. Prints : "I am true interface" followed by " I am false String"

  4. Compile-time error

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

The instanceof operator checks if an object is an instance of a specific type or interface. MyInstanceTest implements MyInterface, so 't instanceof MyInterface' returns true (prints 'I am true interface'). The static variable 's' is null (default value), and 'null instanceof String' returns false (prints 'I am false String'). The instanceof operator safely handles null values by returning false instead of throwing an exception.