how many questions of 1Z0-809 exam dumps?

It is impossible to pass Oracle 1Z0-809 exam without any help in the short term. Come to Ucertify soon and find the most advanced, correct and guaranteed Oracle 1Z0-809 practice questions. You will get a surprising result by our Far out Java SE 8 Programmer II practice guides.


2024 Oracle Official New Released 1Z0-809 ♥♥
https://www.certleader.com/1Z0-809-dumps.html


Q1. 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:

Q2. Given the code fragment: 

List<Integer> nums = Arrays.asList (10, 20, 8): 

System.out.println ( 

//line n1 

); 

Which code fragment must be inserted at line n1 to enable the code to print the maximum number in the nums list? 

A. nums.stream().max(Comparator.comparing(a -> a)).get() 

B. nums.stream().max(Integer : : max).get() 

C. nums.stream().max() 

D. nums.stream().map(a -> a).max() 

Answer:

Q3. You have been asked to create a ResourceBundle which uses a properties file to localize an application. 

Which code example specifies valid keys of menu1 and menu2 with values of File Menu and View Menu? 

A. <key name = ‘menu1”>File Menu</key> <key name = ‘menu2”>View Menu</key> 

B. <key>menu1</key><value>File Menu</value> <key>menu2</key><value>View Menu</value> 

C. menu1, File Menu, menu2, View Menu 

D. menu1 = File Menu menu2 = View Menu 

Answer:

Q4. Given the code fragment: 

List<Integer> list1 = Arrays.asList(10, 20); 

List<Integer> list2 = Arrays.asList(15, 30); 

//line n1 

Which code fragment, when inserted at line n1, prints 10 20 15 30? 

A. Stream.of(list1, list2) 

.flatMap(list -> list.stream()) 

.forEach(s -> System.out.print(s + “ “)); 

B. Stream.of(list1, list2) 

.flatMap(list -> list.intStream()) 

.forEach(s -> System.out.print(s + “ “)); 

C. list1.stream() 

.flatMap(list2.stream().flatMap(e1 -> e1.stream()) 

.forEach(s -> System.out.println(s + “ “)); 

D. Stream.of(list1, list2) 

.flatMapToInt(list -> list.stream()) 

.forEach(s -> System.out.print(s + “ “)); 

Answer:

Q5. Given the code fragments: 

public class Book implements Comparator<Book> { 

String name; 

double price; 

public Book () {} 

public Book(String name, double price) { 

this.name = name; 

this.price = price; 

public int compare(Book b1, Book b2) { 

return b1.name.compareTo(b2.name); 

public String toString() { 

return name + “:” + price; 

and 

List<Book>books = Arrays.asList (new Book (“Beginning with Java”, 2), new book (“A 

Guide to Java Tour”, 3)); 

Collections.sort(books, new Book()); 

System.out.print(books); 

What is the result? 

A. [A Guide to Java Tour:3, Beginning with Java:2] 

B. [Beginning with Java:2, A Guide to Java Tour:3] 

C. A compilation error occurs because the Book class does not override the abstract method compareTo(). 

D. An Exception is thrown at run time. 

Answer:

Q6. View the exhibit. 

Given the code fragment: 

Which change enables the code to print the following? 

James age: 20 

Williams age: 32 

A. Replacing line 5 with public static void main (String [] args) throws MissingInfoException, AgeOutofRangeException { 

B. Replacing line 5 with public static void main (String [] args) throws.Exception { 

C. Enclosing line 6 and line 7 within a try block and adding: catch(Exception e1) { //code goes here} catch (missingInfoException e2) { //code goes here} catch (AgeOutofRangeException e3) {//code goes here} 

D. Enclosing line 6 and line 7 within a try block and adding: catch (missingInfoException e2) { //code goes here} catch (AgeOutofRangeException e3) {//code goes here} 

Answer:

Q7. Which two items can legally be contained within a java class declaration? 

A. An import statement 

B. A field declaration 

C. A package declaration 

D. A method declaration 

Answer: B,D 

Reference: 

http://docs.oracle.com/javase/tutorial/java/javaOO/methods.html 

Q8. Given: What is the result? 

A. Initialized Started 

B. Initialized Started Initialized 

C. Compilation fails 

D. An exception is thrown at runtime 

Answer:

Q9. Which two statements are true for a two-dimensional array? 

A. It is implemented as an array of the specified element type. 

B. Using a row by column convention, each row of a two-dimensional array must be of the same size. 

C. At declaration time, the number of elements of the array in each dimension must be specified. 

D. All methods of the class Object may be invoked on the two-dimensional array. 

Answer: A,D 

Q10. Given: 

class Sum extends RecursiveAction { //line n1 

static final int THRESHOLD_SIZE = 3; 

int stIndex, lstIndex; 

int [ ] data; 

public Sum (int [ ]data, int start, int end) { 

this.data = data; 

this stIndex = start; 

this. lstIndex = end; 

protected void compute ( ) { 

int sum = 0; 

if (lstIndex – stIndex <= THRESHOLD_SIZE) { 

for (int i = stIndex; i < lstIndex; i++) { 

sum += data [i]; 

System.out.println(sum); 

} else { 

new Sum (data, stIndex + THRESHOLD_SIZE, lstIndex).fork( ); 

new Sum (data, stIndex, 

Math.min (lstIndex, stIndex + THRESHOLD_SIZE) 

).compute (); 

and the code fragment: 

ForkJoinPool fjPool = new ForkJoinPool ( ); int data [ ] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} fjPool.invoke (new Sum (data, 0, data.length)); 

and given that the sum of all integers from 1 to 10 is 55. Which statement is true? 

A. The program prints several values that total 55. 

B. The program prints 55. 

C. A compilation error occurs at line n1. 

D. The program prints several values whose sum exceeds 55. 

Answer: