Java Reference
In-Depth Information
12. public Child() {
13. this(123);
14. System.out.print(“C”);
15. }
16.}
what is the output of the following statement?
new Child();
A. ABC
B. ACB
C. AB
D. AC
E. This code does not compile.
3. Which of the following identifiers are valid Java identifiers? (Select three.)
A. A$B
B. _helloWorld
C. transient
D. java.lang
E. Public
F. 1980_s
4. What is the output of the following program?
1. public class WaterBottle {
2. private String brand;
3. private boolean empty;
4.
5. public static void main(String [] args ) {
6. WaterBottle wb = new WaterBottle();
7. if(!wb.empty) {
8. System.out.println(“Brand = “ + wb.brand);
9. }
10. }
11.}
A. Line 6 generates a compiler error.
B. Line 7 generates a compiler error.
C. Line 8 generates a compiler error.
D. There is no output.
E. Brand = null
Search WWH ::




Custom Search