Question 31

Given the code fragment:
1Z0-809 dumps exhibit
Which is the valid definition of the Course enum?
1Z0-809 dumps exhibit
1Z0-809 dumps exhibit

Correct Answer:A

Question 32

Which two are elements of a singleton class? (Choose two.)

Correct Answer:BD

Question 33

Given:
class Worker extends Thread { CyclicBarrier cb;
public Worker(CyclicBarrier cb) { this.cb = cb; } public void run () {
try { cb.await();
System.out.println(“Worker…”);
} catch (Exception ex) { }
}
}
class Master implements Runnable { //line n1 public void run () { System.out.println(“Master…”);
}
}
and the code fragment:
Master master = new Master();
//line n2
Worker worker = new Worker(cb); worker.start();
You have been asked to ensure that the run methods of both the Worker and Master classes are executed. Which modification meets the requirement?

Correct Answer:C

Question 34

Given the code fragment:
List str = Arrays.asList (“my”, “pen”, “is”, “your’, “pen”); Predicate test = s -> {
int i = 0;
boolean result = s.contains (“pen”);
System.out.print(i++) + “:”); return result;
};
str.stream()
.filter(test)
.findFirst()
.i fPresent(System.out ::print); What is the result?

Correct Answer:A

Question 35

Given:
1Z0-809 dumps exhibit
and the code fragment:
1Z0-809 dumps exhibit
What is the result?

Correct Answer:B

Question 36

Given: Book.java:
public class Book {
private String read(String bname) { return “Read” + bname }
}
EBook.java:
public class EBook extends Book {
public class String read (String url) { return “View” + url }
}
Test.java:
public class Test {
public static void main (String[] args) { Book b1 = new Book();
b1.read(“Java Programing”); Book b2 = new EBook();
b2.read(“http://ebook.com/ebook”);
}
}
What is the result?

Correct Answer:D

START 1Z0-809 EXAM