D) Compilation fails due to an error on line 5.
E) Compilation fails due to an error on line 6.
F) Compilation fails due to errors on multiple lines.
60.
Given two files:
1. package x;
2. public class X {
3. public static void doX() { System.out.print("doX "); }
4. }
And:
1. class Find {
Page 25 of 30
2. public static void main(String [] args) {
3. // insert code here
4. }
5. }
Which two, inserted independently at line 3 in class Find, will compile and produce
the output "doX"? (Choose two.)
A) doX();
B) X.doX();
C) x.X.doX();
D) X myX = new X(); myX.doX();
E) x.X myX = new x.X(); myX.doX();
61.
Given:
1. class TestMain {
2. static int x = 2;
3. static { x = 4; }
4. public static void main(String... args) {
5. int y = x + 1;
6. System.out.println(y);
7. }
8. }
And the command line:
java TestMain
What is the result?
A) 3
B) 5
C) Compilation fails.
D) An exception is thrown at runtime.
62.
Given:
1. class java {
2. public static void main(String [] java) {
3. for (int Java = 1; Java < java.length; Java++)
4. System.out.print("java ");
5. }
6. }
And the command line:
java java java java java
What is the result?
A) java
B) java java
C) java java java
D) Compilation fails
E) An exception is thrown at runtime
Page 26 of 30
63.
Given:
5. class Wrench2 {
6. int size;
7. public static void main(String [] args) {
8. Wrench2 w = new Wrench2();
9. w.size = 9;