Top Oracle 1Z0-809 samples Choices

Testking offers free demo for 1Z0-809 exam. "Java SE 8 Programmer II", also known as 1Z0-809 exam, is a Oracle Certification. This set of posts, Passing the Oracle 1Z0-809 exam, will help you answer those questions. The 1Z0-809 Questions & Answers covers all the knowledge points of the real exam. 100% real Oracle 1Z0-809 exams and revised by experts!


♥♥ 2021 NEW RECOMMEND ♥♥

Free VCE & PDF File for Oracle 1Z0-809 Real Exam (Full Version!)

★ Pass on Your First TRY ★ 100% Money Back Guarantee ★ Realistic Practice Exam Questions

Free Instant Download NEW 1Z0-809 Exam Dumps (PDF & VCE):
Available on: http://www.surepassexam.com/1Z0-809-exam-dumps.html

Q21. Given: 

A. Ym Xm2 

B. Ym Xm1 

C. Compilation fails 

D. A ClassCastException is thrown at runtime 

Answer:


Q22. Given the content of /resourses/Message.properties: 

welcome1=”Good day!” 

and given the code fragment: 

Properties prop = new Properties (); 

FileInputStream fis = new FileInputStream (“/resources/Message.properties”); 

prop.load(fis); 

System.out.println(prop.getProperty(“welcome1”)); 

System.out.println(prop.getProperty(“welcome2”, “Test”));//line n1 

System.out.println(prop.getProperty(“welcome3”)); 

What is the result? 

A. Good day! 

Test 

followed by an Exception stack trace 

B. Good day! 

followed by an Exception stack trace 

C. Good day! 

Test 

null 

D. A compilation error occurs at line n1. 

Answer:


Q23. Given: 

What is the result? 

A. Red 0 Orange 0 Green 3 

B. Red 0 Orange 0 Green 6 

C. Red 0 Orange 1 

D. Green 4 

E. Compilation fails 

Answer:


Q24. Given the code fragment: 

public class Foo { 

public static void main (String [ ] args) { 

Map<Integer, String> unsortMap = new HashMap< > ( ); 

unsortMap.put (10, “z”); 

unsortMap.put (5, “b”); 

unsortMap.put (1, “d”); 

unsortMap.put (7, “e”); 

unsortMap.put (50, “j”); 

Map<Integer, String> treeMap = new TreeMap <Integer, String> (new 

Comparator<Integer> ( ) { 

@Override public int compare (Integer o1, Integer o2) {return o2.compareTo 

(o1); } } ); 

treeMap.putAll (unsortMap); 

for (Map.Entry<Integer, String> entry : treeMap.entrySet () ) { 

System.out.print (entry.getValue () + “ “); 

What is the result? 

A. A compilation error occurs. 

B. d b e z j 

C. j z e b d 

D. z b d e j 

Answer:


Q25. Given: 

class Student { 

String course, name, city; 

public Student (String name, String course, String city) { 

this.course = course; this.name = name; this.city = city; 

public String toString() { 

return course + “:” + name + “:” + city; 

and the code fragment: 

List<Student> stds = Arrays.asList( 

new Student (“Jessy”, “Java ME”, “Chicago”), 

new Student (“Helen”, “Java EE”, “Houston”), 

new Student (“Mark”, “Java ME”, “Chicago”)); 

stds.stream() 

.collect(Collectors.groupingBy(Student::getCourse)) 

.forEach(src, res) -> System.out.println(scr)); 

What is the result? 

A. [Java EE: Helen:Houston] 

[Java ME: Jessy:Chicago, Java ME: Mark:Chicago] 

B. Java EE 

Java ME 

C. [Java ME: Jessy:Chicago, Java ME: Mark:Chicago] 

[Java EE: Helen:Houston] 

D. A compilation error occurs. 

Answer:


Q26. Given: 

public interface Moveable<Integer> { 

public default void walk (Integer distance) {System.out.println(“Walking”);) 

public void run(Integer distance); 

Which statement is true? 

A. Moveable can be used as below: 

Moveable<Integer> animal = n - > System.out.println(“Running” + n); 

animal.run(100); 

animal.walk(20); 

B. Moveable can be used as below: 

Moveable<Integer> animal = n - > n + 10; 

animal.run(100); 

animal.walk(20); 

C. Moveable can be used as below: 

Moveable animal = (Integer n) - > System.out.println(n); 

animal.run(100); 

Moveable.walk(20); 

D. Movable cannot be used in a lambda expression. 

Answer:


Q27. Given the code fragments: 

class Employee { 

Optional<Address> address; 

Employee (Optional<Address> address) { 

this.address = address; 

public Optional<Address> getAddress() { return address; } 

class Address { 

String city = “New York”; 

public String getCity { return city: } 

public String toString() { 

return city; 

and 

Address address = null; 

Optional<Address> addrs1 = Optional.ofNullable (address); 

Employee e1 = new Employee (addrs1); 

String eAddress = (addrs1.isPresent()) ? addrs1.get().getCity() : “City Not 

available”; 

What is the result? 

A. New York 

B. City Not available 

C. null 

D. A NoSuchElementException is thrown at run time. 

Answer:


Q28. Given: 

public class Emp { 

String fName; 

String lName; 

public Emp (String fn, String ln) { 

fName = fn; 

lName = ln; 

public String getfName() { return fName; } 

public String getlName() { return lName; } 

and the code fragment: 

List<Emp> emp = Arrays.asList ( 

new Emp (“John”, “Smith”), 

new Emp (“Peter”, “Sam”), 

new Emp (“Thomas”, “Wale”)); 

emp.stream() 

//line n1 

.collect(Collectors.toList()); 

Which code fragment, when inserted at line n1, sorts the employees list in descending order of fName and then ascending order of lName? 

A. .sorted (Comparator.comparing(Emp::getfName).reserved().thenComparing(Emp::getlName)) 

B. .sorted (Comparator.comparing(Emp::getfName).thenComparing(Emp::getlName)) 

C. .map(Emp::getfName).sorted(Comparator.reserveOrder()) 

D. 

.map(Emp::getfName).sorted(Comparator.reserveOrder().map(Emp::getlName).reserved 

Answer:


Q29. Given: 

public enum USCurrency { 

PENNY (1), 

NICKLE(5), 

DIME (10), 

QUARTER(25); 

private int value; 

public USCurrency(int value) { 

this.value = value; 

public int getValue() {return value;} 

public class Coin { 

public static void main (String[] args) { 

USCurrency usCoin =new USCurrency.DIME; 

System.out.println(usCoin.getValue()): 

Which two modifications enable the given code to compile? 

A. Nest the USCurrency enumeration declaration within the Coin class. 

B. Make the USCurrency enumeration constructor private. 

C. Remove the new keyword from the instantion of usCoin. 

D. Make the getter method of value as a static method. 

E. Add the final keyword in the declaration of value. 

Answer: A,E 


Q30. Which three statements are benefits of encapsulation? 

A. Allows a class implementation to change without changing t he clients 

B. Protects confidential data from leaking out of the objects 

C. Prevents code from causing exceptions 

D. Enables the class implementation to protect its invariants 

E. Permits classes to be combined into the same package 

F. Enables multiple instances of the same class to be created safely 

Answer: A,B,D