Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-853
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-853.html
Java Standard Edition 5 Programmer Certified Professional Exam
Question No: 231 – (Topic 3)
Given:
-
public class Person {
-
private String name;
-
public Person(String name) { this.name = name; }
-
public boolean equals(Person p) {
-
return p.name.equals(this.name); 6. }
7. }
Which statement is true?
-
Compilation fails because the private attribute p.name cannot be accessed in line 5.
-
The equals method does NOT properly override the Object.equals method.
-
To work correctly with hash-based data structures, this class must also implement the hashCode method.
-
When adding Person objects to a java.util.Set collection, the equals method in line 4 will prevent duplicates.
-
Answer: B
Question No: 232 – (Topic 3)
Given:
d is a valid, non-null Date object
df is a valid, non-null DateFormat object set to the current locale
What outputs the current locale#39;s country name and the appropriate version of d#39;s date?
-
Locale loc = Locale.getLocale(); System.out.println(loc.getDisplayCountry()
quot; quot; df.format(d));
-
Locale loc = Locale.getDefault(); System.out.println(loc.getDisplayCountry()
quot; quot; df.setDateFormat(d));
-
Locale loc = Locale.getLocale(); System.out.println(loc.getDisplayCountry()
quot; quot; df.setDateFormat(d));
-
Locale loc = Locale.getDefault(); System.out.println(loc.getDisplayCountry()
quot; quot; df.format(d));
Answer: D
Question No: 233 – (Topic 3)
Given:
-
public class TestSeven extends Thread {
-
private static int x;
-
public synchronized void doThings() {
-
int current = x;
-
current ;
-
x = current; 7. }
-
-
public void run() {
-
doThings();
10. } 11.}
Which statement is true?
-
Compilation fails.
-
Synchronizing the run() method would make the class thread-safe.
-
An exception is thrown at runtime.
-
The data in variable quot;xquot; are protected from concurrent access problems.
-
Wrapping the statements within doThings() in a synchronized(new Object()) { } block would make the class thread-safe.
-
Declaring the doThings() method as static would make the class thread-safe.
-
Answer: F
Question No: 234 – (Topic 3)
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.)
-
The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -cp
/foo/myLib.jar/Paper Book.java.
-
The JAR file is located at $JAVA_HOME/jre/classes/myLib.jar.
-
The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar/Paper.class.
-
The JAR file is located at $JAVA_HOME/jre/lib/ext/myLib.jar..
-
The JAR file is located at /foo/myLib.jar and a classpath environment variable is set that includes /foo/myLib.jar.
-
The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac – classpath /foo/myLib.jar Book.java
-
The JAR file is located at /foo/myLib.jar and the Book class is compiled using javac -d
/foo/myLib.jar Book.java
Answer: D,E,F
Question No: 235 – (Topic 3)
Given:
-
class ClassA {}
-
class ClassB extends ClassA {}
-
class ClassC extends ClassA {} and:
-
ClassA p0 = new ClassA();
-
ClassB p1 = new ClassB();
-
ClassC p2 = new ClassC();
-
ClassA p3 = new ClassB();
-
ClassA p4 = new ClassC();
Which three are valid? (Choose three.)
-
p0 = p1;
-
p1 = (ClassB)p3;
-
p2 = (ClassC)p1;
-
p2 = (ClassC)p4;
-
p2 = p4;
-
p1 = p2;
Answer: A,B,D
Question No: 236 – (Topic 3)
Which Man class properly represents the relationship quot;Man has a best friend who is a Dogquot;?
-
class Man extends Dog { }
-
class Man { private Doglt;bestFriendgt;; }
-
class Man implements Dog { }
-
class Man { private Dog bestFriend; }
-
class Man { private BestFriendlt;doggt;; }
-
class Man { private BestFriend dog; }
Answer: D
Question No: 237 DRAG DROP – (Topic 3)
Click the Task button.
Answer:
Question No: 238 – (Topic 3)
Assuming that the serializeBanana() and the deserializeBanana() methods will correctly use Java serialization and given:
-
import java.io.*;
-
class Food implements Serializable {int good = 3;}
-
class Fruit extends Food {int juice = 5;}
-
public class Banana extends Fruit {
-
int yellow = 4;
-
public static void main(String [] args) {
-
Banana b = new Banana(); Banana b2 = new Banana();
-
b.serializeBanana(b); // assume correct serialization
-
b2 = b.deserializeBanana(); // assume correct
-
System.out.println(quot;restore quot; b2.yellow b2.juice b2.good);
24. }
25. // more Banana methods go here 50. } What is the result?
-
restore 403
-
An exception is thrown at runtime.
-
Compilation fails.
-
restore 453
-
restore 400
Answer: D
Question No: 239 – (Topic 3)
Given:
-
import java.util.*;
-
public class PQ {
-
public static void main(String[] args) {
-
PriorityQueuelt;Stringgt; pq = new PriorityQueuelt;Stringgt;();
-
pq.add(quot;carrotquot;);
-
pq.add(quot;applequot;);
-
pq.add(quot;bananaquot;);
-
System.out.println(pq.poll() quot;:quot; pq.peek()); 9. }
10. }
What is the result?
-
banana:apple
-
carrot:apple
-
apple:banana
-
carrot:banana
-
apple:apple
-
carrot:carrot
Answer: C
Question No: 240 – (Topic 3)
Given:
-
public class A {
-
public void doit() { 3. }
-
-
-
-
public String doit() {
-
return quot;aquot;; 6. }
-
public double doit(int x) {
-
return 1.0; 9. }
10. }
What is the result?
-
Compilation fails because of an error in line 7.
-
An exception is thrown at runtime.
-
Compilation fails because of an error in line 4.
-
Compilation succeeds and no runtime errors with class A occur.
Answer: C
100% Ensurepass Free Download!
–Download Free Demo:1z0-853 Demo PDF
100% Ensurepass Free Guaranteed!
–1z0-853 DumpsEnsurePass ExamCollection Testking Lowest Price Guarantee Yes No No Up-to-Dated Yes No No Real Questions Yes No No Explanation Yes No No PDF VCE Yes No No Free VCE Simulator Yes No No Instant Download Yes No No HOT CATEGORY!HOT EXAM!100-105 Dumps VCE PDF
200-105 Dumps VCE PDF
300-101 Dumps VCE PDF
300-115 Dumps VCE PDF
300-135 Dumps VCE PDF
300-320 Dumps VCE PDF
400-101 Dumps VCE PDF
640-911 Dumps VCE PDF
640-916 Dumps VCE PDF
70-410 Dumps VCE PDF
70-411 Dumps VCE PDF
70-412 Dumps VCE PDF
70-413 Dumps VCE PDF
70-414 Dumps VCE PDF
70-417 Dumps VCE PDF
70-461 Dumps VCE PDF
70-462 Dumps VCE PDF
70-463 Dumps VCE PDF
70-464 Dumps VCE PDF
70-465 Dumps VCE PDF
70-480 Dumps VCE PDF
70-483 Dumps VCE PDF
70-486 Dumps VCE PDF
70-487 Dumps VCE PDF
220-901 Dumps VCE PDF
220-902 Dumps VCE PDF
N10-006 Dumps VCE PDF
SY0-401 Dumps VCE PDF
-