Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
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); } }
NULL
Compile Error
Code runs but no output
Runtime Exception
Show Answer
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
Next →
Discussion & Comments
No comments yet. Be the first to comment!
Name:
Comment:
Post Comment