Multiple choice technology programming languages

Following code will result in: class A { int b = 1; public static void main(String [] args) { System.out.println("b is " + b); }}

  1. Compilation error

  2. Runtime Error

  3. Runtime Exception

  4. Output of b is 1

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

Non-static variable b cannot be referenced from a static context (main method). Attempting to access it directly without creating an instance of class A causes a compilation error. Runtime options are incorrect because compilation fails first.