Important Java Mcq 1

Which of the following declaration does not compile?

a. double num1, int num2 =0;

b. double num1, int num2 =0;

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 datatype, semi-colon should be placed. In the above option a after declaring num1 as double, a semi-colon should have been placed, then that declaration would have compiled correctly.

Related MCQs
Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?