A developer is creating a class Book, that needs to access class Paper. The Paper class is deployed in a JAR named myLib.jar. Which three, taken independently, will allow the developer to use the Paper class while compiling the Book class? (Choose three.)
A. The JAR file is located at $JAVA_HOME/jre/classes/myLib.jar.Which Man class properly represents the relationship "Man has a best friend who is a Dog"?
A. class Man extends Dog { }Given:
11.
public static void main(String[] args) {
12.
try {
13.
args = null;
14.
args[0] = "test";
15.
System.out.println(args[0]);
16.
} catch (Exception ex) {
17.
System.out.println("Exception");
18.
} catch (NullPointerException npe) {
19.
System.out.println("NullPointerException");
20.
}
21.
}
What is the result?
A. testA company that makes Computer Assisted Design (CAD) software has, within its application, some utility classes that are used to perform 3D rendering tasks. The company's chief scientist has just improved the performance of one of the utility classes' key rendering algorithms, and has assigned a programmer to replace the old algorithm with the new algorithm. When the programmer begins researching the utility classes, she is happy to discover that the algorithm to be replaced exists in only one class. The programmer reviews that class's API, and replaces the old algorithm with the new algorithm, being careful that her changes adhere strictly to the class's API. Once testing has begun, the programmer discovers that other classes that use the class she changed are no longer working properly. What design flaw is most likely the cause of these new bugs?
A. InheritanceGiven:
3.
import java.util.*;
4.
public class Mapit {
5.
public static void main(String[] args) {
6.
Set
7.
Integer i1 = 45;
8.
Integer i2 = 46;
9.
set.add(i1);
10.
set.add(i1);
11.
set.add(i2); System.out.print(set.size() + " ");
12.
set.remove(i1); System.out.print(set.size() + " ");
13.
i2 = 47;
14.
set.remove(i2); System.out.print(set.size() + " ");
15.
}
16.
}
What is the result?
A. 2 1 0Given:
1.
public class GC {
2.
private Object o;
3.
private void doSomethingElse(Object obj) { o = obj; }
4.
public void doSomething() {
5.
Object o = new Object();
6.
doSomethingElse(o);
7.
o = new Object();
8.
doSomethingElse(null);
9.
o = null;
10.
}
11.
}
When the doSomething method is called, after which line does the Object created in line 5 become available for garbage collection?
A. Line 5Given:
11. class X { public void foo() { System.out.print("X "); } } 12.
13.
public class SubB extends X {
14.
public void foo() throws RuntimeException {
15.
super.foo();
16.
if (true) throw new RuntimeException();
17.
System.out.print("B ");
18.
}
19.
public static void main(String[] args) {
20.
new SubB().foo();
21.
}
22.
}
What is the result?
A. X, followed by an Exception.A UNIX user named Bob wants to replace his chess program with a new one, but he is not sure where the old one is installed. Bob is currently able to run a Java chess program starting from his home directory /home/bob using the command: java - classpath /test:/home/bob/downloads/*.jar games.Chess Bob's CLASSPATH is set (at login time) to:
/usr/lib:/home/bob/classes:/opt/java/lib:/opt/java/lib/*.jar
What is a possible location for the Chess.class file?
A. /test/Chess.classGiven:
1. public class Threads2 implements Runnable { 2.
3.
public void run() {
4.
System.out.println("run.");
5.
throw new RuntimeException("Problem");
6.
}
7.
public static void main(String[] args) {
8.
Thread t = new Thread(new Threads2());
9.
t.start();
10.
System.out.println("End of method.");
11.
}
12.
}
Which two can be results? (Choose two.)
A. java.lang.RuntimeException: ProblemGiven:
13.
public class Pass {
14.
public static void main(String [] args) {
15.
int x = 5;
16.
Pass p = new Pass();
17.
p.doStuff(x);
18.
System.out.print(" main x = " + x);
19.
}
20.
21.
void doStuff(int x) {
22.
System.out.print(" doStuff x = " + x++);
23.
}
24.
}
What is the result?
A. Compilation fails.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.