Multiple choice technology programming languages

package statictest; public class TestStatic { public static void message() { System.out.println("In message"); } public static void main(String arg[]) { TestStatic a = null; a.message (); } }

  1. Null Pointer exception

  2. In message

  3. Compiler error

  4. No output

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

Static methods belong to the class, not to instances. When you call a.message() on a null reference, Java doesn't throw a NullPointerException because the call is resolved at compile-time based on the declared type (TestStatic), not the runtime value of the reference.