Multiple choice

What will be the output of the program? public class Test { public static void main (String args[]) { String str = NULL; System.out.println(str); } }

  1. NULL

  2. Compile Error

  3. Code runs but no output

  4. Runtime Exception

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

Option B is correct because to set the value of a String variable to null you must use "null" and not "NULL".