Given:
11.
class Animal { public String noise() { return "peep"; } }
12.
class Dog extends Animal {
13.
public String noise() { return "bark"; }
14.
}
15.
class Cat extends Animal {
16.
public String noise() { return "meow"; }
17.
} ...
30.
Animal animal = new Dog();
31.
Cat cat = (Cat)animal;
32.
System.out.println(cat.noise());
What is the result?
A. peepClick the Exhibit button. Given:
31.
public void method() {
32.
A a = new A();
33.
a.method1();
34.
}
Which statement is true if a TestException is thrown on line 3 of class B?

Given:
1.
package com.company.application;
2.
3.
public class MainClass {
4.
public static void main(String[] args) {}
5.
}
And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH environment variable is set to "." (current directory).
Which two java commands entered at the command line will run MainClass? (Choose two.)
A. java MainClass if run from the /apps directoryGiven:
1.
public class TestString3 {
2.
public static void main(String[] args) {
3.
// insert code here
5.
System.out.println(s);
6.
}
7.
}
Which two code fragments, inserted independently at line 3, generate the output 4247? (Choose two.)
A. String s = "123456789"; s = (s-"123").replace(1,3,"24") - "89";Select and Place:

Given:
1.
public class TestFive {
2.
private int x;
3.
public void foo() {
4.
int current = x;
5.
x = current + 1;
6.
}
7.
public void go() {
8.
for(int i = 0; i < 5; i++) {
9.
new Thread() {
10.
public void run() {
11.
foo();
12.
System.out.print(x + ", ");
13.
} }.start();
14.
} }
Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ? (Choose two.)
A. move the line 12 print statement into the foo() methodWhich two code fragments are most likely to cause a StackOverflowError? (Choose two.)
A. int []x = {1,2,3,4,5}; for(int y = 0; y < 6; y++) System.out.println(x[y]);Given two files, GrizzlyBear.java and Salmon.java:
1. package animals.mammals;
2.
3. public class GrizzlyBear extends Bear {
4. void hunt() {
5. Salmon s = findSalmon();
6. s.consume();
7. }
8. }
1. package animals.fish;
2.
3. public class Salmon extends Fish {
4. public void consume() { /* do stuff */ }
5. }
If both classes are in the correct directories for their packages, and the Mammal class correctly defines the findSalmon() method, which change allows this code to compile?
A. add import animals.mammals.*; at line 2 in Salmon.javaGiven:
11.
String test = "Test A. Test B. Test C.";
12.
// insert code here
13.
String[] result = test.split(regex);
Which regular expression, inserted at line 12, correctly splits test into "Test A", "Test B", and "Test C"?
A. String regex = "";Which two code fragments will execute the method doStuff() in a separate thread? (Choose two.)
A. new Thread() { public void run() { doStuff(); } };Nowadays, 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.