Important Java Mcq 1

Which of the following declaration does not compile?

a. double num1, int num2 =0;

b. int num1,num2;

c. int num1, num2 = 0;

d. int num1 = 0, num2 = 0;

Answer:

a. double num1, int num2 = 0;

Explanation

After declaring a variable or a group of variables of same data type semi-colon should be placed. In the above option a. after declaring num1 as double a semi-colon should be placed, then that declaration would compile correctly.

Related MCQs
Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?