Java Programming
primer-original-v2mediumJava Programming02 Eclipse Ideprimer-original-v2

Predict the output int a=0; if(a) System.out.println( "Hello"); else System.out.println( "Hai");

Answer options

A
Need to include the braces { } for the code to work
B
Hai
C
Hello
D
Compilation Fails

Correct answer: Compilation Fails

Explanation

Quick AnswerThe correct answer is Compilation Fails because it directly addresses the core logic of Java Programming.

This question has been retained as-is due to its unique context.

Related Java Programming questions

Practice more Java Programming questions

PrimerPrep has independently reviewed practice questions and coding exercises — all free.