Given:
1.
public class Base {
2.
public static final String FOO = "foo";
3.
public static void main(String[] args) {
4.
Base b = new Base();
5.
Sub s = new Sub();
6.
System.out.print(Base.FOO);
7.
System.out.print(Sub.FOO);
8.
System.out.print(b.FOO);
9.
System.out.print(s.FOO);
10.
System.out.print(((Base)s).FOO);
11.
} }
12.
class Sub extends Base {public static final String FOO="bar";}
What is the result?
A. foofoofoofoofooGiven:
1.
class ClassA {
2.
public int numberOfInstances;
3.
protected ClassA(int numberOfInstances) {
4.
this.numberOfInstances = numberOfInstances;
5.
}
6.
}
7.
public class ExtendedA extends ClassA {
8.
private ExtendedA(int numberOfInstances) {
9.
super(numberOfInstances);
10.
}
11.
public static void main(String[] args) {
12.
ExtendedA ext = new ExtendedA(420);
13.
System.out.print(ext.numberOfInstances);
14.
}
15.
}
Which statement is true?
A. 420 is the output.Given:
11.
public class PingPong implements Runnable {
12.
synchronized void hit(long n) {
13.
for(int i = 1; i < 3; i++)
14.
System.out.print(n + "-" + i + " ");
15.
}
16.
public static void main(String[] args) {
17.
new Thread(new PingPong()).start();
18.
new Thread(new PingPong()).start();
19.
}
20.
public void run() {
21.
hit(Thread.currentThread().getId());
22.
}
23.
}
Which two statements are true? (Choose two.)
A. The output could be 8-1 7-2 8-2 7-1Given:
11.
public class Person {
12.
private String name, comment;
13.
private int age;
14.
public Person(String n, int a, String c) {
15.
name = n; age = a; comment = c;
16.
}
17.
public boolean equals(Object o) {
18.
if (! (o instanceof Person)) return false; 19, Person p = (Person)o;
20.
return age == p.age andand name.equals(p.name);
21.
}
22.
}
What is the appropriate definition of the hashCode method in class Person?
A. return super.hashCode();Which Man class properly represents the relationship "Man has a best friend who is a Dog"?
A. class Man extends Dog { }Given:
12.
Date date = new Date();
13.
df.setLocale(Locale.ITALY);
14.
String s = df.format(date);
The variable df is an object of type DateFormat that has been initialized in line 11.
What is the result if this code is run on December 14, 2000?
A. The value of s is 14-dic-2000.Click the Exhibit button. What is the result?

Given:
11.
public class ItemTest {
12.
private final int id;
13.
public ItemTest(int id) { this.id = id; }
14.
public void updateId(int newId) { id = newId; } 15.
16.
public static void main(String[] args) {
17.
ItemTest fa = new ItemTest(42);
18.
fa.updateId(69);
19.
System.out.println(fa.id);
20.
}
21.
}
What is the result?
A. Compilation fails.Which two code fragments correctly create and initialize a static array of int elements? (Choose two.)
A. static final int[] a = { 100,200 };Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo() method, which two statements are true? (Choose two.)
A. The class implements java.lang.Comparable.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.