Home » Java Programming » Objects and Collections

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

Correct Answer: Compile Error

Explanation:

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

← Previous Question Next Question→

More Questions from Objects and Collections

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion