Oracle
1Z0-808 · Question #21
Given the content of three files: A.java: public class A { public void a () {} int a; } B.java: public class B { private int doStuff() { private int x = 100; return x++; } } C.java: import…
Sign in or unlock 1Z0-808 to reveal the answer and full explanation for question #21. The question stem and answer options stay visible for context.
Java Class Design
Question
Given the content of three files:
A.java:
public class A {
public void a () {}
int a;
}
B.java:
public class B {
private int doStuff() {
private int x = 100;
return x++;
}
}
C.java:
import java.io.*;
package p1;
class A {
public public void main(String fileName) throws IOException {}
}
Which statement is true?
Options
- AOnly the A.java file compiles successfully.
- BOnly the B.java file compiles successfully.
- COnly the C.java file compiles successfully.
- DThe A.java and B.java files compile successfully.
- EThe B.java and C.java files compile successfully.
- FThe A.java and C.java files compile successfully.
Unlock 1Z0-808 to see the answer
You've previewed enough free 1Z0-808 questions. Unlock 1Z0-808 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#compilation rules#package declaration#access modifiers#class structure