Given:
1.
public class Threads4 {
2.
public static void main (String[] args) {
3.
new Threads4().go();
4.
}
5.
public void go() {
6.
Runnable r = new Runnable() {
7.
public void run() {
8.
System.out.print("foo");
9.
}
10.
};
11.
Thread t = new Thread(r);
12.
t.start();
13.
t.start();
14.
}
15.
}
What is the result?
A. Compilation fails.DRAG DROP
Select and Place:

Given a class Repetition:
1.
package utils;
2.
3.
public class Repetition {
4.
public static String twice(String s) { return s + s; }
5.
} and given another class Demo:
1.
// insert code here
2.
3.
public class Demo {
4.
public static void main(String[] args) {
5.
System.out.println(twice("pizza"));
6.
}
7.
}
Which code should be inserted at line 1 of Demo.java to compile and run Demo to print "pizzapizza"?
A. import utils.*;DRAG DROP
Select and Place:

Given that the current directory is empty, and that the user has read and write permissions, and the following:
11.
import java.io.*;
12.
public class DOS {
13.
public static void main(String[] args) {
14.
File dir = new File("dir");
15.
dir.mkdir();
16.
File f1 = new File(dir, "f1.txt");
17.
try {
18.
f1.createNewFile();
19.
} catch (IOException e) { ; }
20.
File newDir = new File("newDir");
21.
dir.renameTo(newDir);
22.
}
23.
}
Which statement is true?
A. Compilation fails.Given:
10.
class Nav{
11.
public enum Direction { NORTH, SOUTH, EAST, WEST }
12.
}
13.
public class Sprite{
14.
// insert code here
15.
}
Which code, inserted at line 14, allows the Sprite class to compile?
A. Direction d = NORTH;Given:
3. public class Batman {
4. int squares = 81;
5. public static void main(String[] args) {
6.
new Batman().go();
7.
}
8.
void go() {
9.
incr(++squares);
10.
System.out.println(squares);
11.
}
12.
void incr(int squares) { squares += 10; }
13.
}
What is the result?
A. 81DRAG DROP
Select and Place:

Given:
1.
interface A { public void aMethod(); }
2.
interface B { public void bMethod(); }
3.
interface C extends A,B { public void cMethod(); }
4.
class D implements B {
5.
public void bMethod(){}
6.
}
7.
class E extends D implements C {
8.
public void aMethod(){}
9.
public void bMethod(){}
10.
public void cMethod(){}
11.
}
What is the result?
A. Compilation fails because of an error in line 3.Given:
21.
abstract class C1 {
22.
public C1() { System.out.print(1); }
23.
}
24.
class C2 extends C1 {
25.
public C2() { System.out.print(2); }
26.
}
27.
class C3 extends C2 {
28.
public C3() { System.out.println(3); }
29.
}
30.
public class Ctest {
31.
public static void main(String[] a) { new C3(); }
32.
}
What is the result?
A. 3Nowadays, the certification exams become more and more important and required by more and more enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare for the exam in a short time with less efforts? How to get a ideal result and how to find the most reliable resources? Here on Vcedump.com, you will find all the answers. Vcedump.com provide not only Oracle exam questions, answers and explanations but also complete assistance on your exam preparation and certification application. If you are confused on your 1Z0-851 exam preparations and Oracle certification application, do not hesitate to visit our Vcedump.com to find your solutions here.