Given: Which two declarations will compile?
A.
int d, e, F;
B.
int a, b, c = 0;
C.
int k, l, m; = 0;
D.
int a, b, c;
E.
int g, int h, int i = 0;
Given: Which two declarations will compile?
A.
int d, e, F;
B.
int a, b, c = 0;
C.
int k, l, m; = 0;
D.
int a, b, c;
E.
int g, int h, int i = 0;
Answer given is correct
Answers: A, B
Explanation:
D is wrong because int a, b, c; can’t compile as long int a, b, c = 0; is present because we have duplicate variables.
C is wrong because Int k, l, m; = 0; can’t compile since Int is incorrectly written.
E is wrong because int g, int h, int i = 0; java doesn’t support this syntax.