GIAC
GSSP-JAVA · Question #159
You work as a Software Developer for Developer Inc. You write the following code. interface A {public boolean b = false;} class C implements A {public static void main(String args[]) {b =…
The correct answer is D. The code will not compile. See the full explanation below for the reasoning.
Question
You work as a Software Developer for Developer Inc. You write the following code. interface A {public boolean b = false;} class C implements A {public static void main(String args[]) {b = true;System.out.println(b);}} Which of the following will be the result, when you try to compile and execute the above code?
Options
- AThe code will compile and print false.
- BThe code will compile, but it will not execute.
- CThe code will compile and print true.
- DThe code will not compile.
How the community answered
(40 responses)- A5% (2)
- B3% (1)
- C15% (6)
- D78% (31)
Community Discussion
No community discussion yet for this question.