Oracle Java SE 21 Developer Professional - 1z0-830 Exam Practice Test

Given:
java
StringBuffer us = new StringBuffer("US");
StringBuffer uk = new StringBuffer("UK");
Stream<StringBuffer> stream = Stream.of(us, uk);
String output = stream.collect(Collectors.joining("-", "=", ""));
System.out.println(output);
What is the given code fragment's output?

Correct Answer: D Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).
Given:
java
Integer frenchRevolution = 1789;
Object o1 = new String("1789");
Object o2 = frenchRevolution;
frenchRevolution = null;
Object o3 = o2.toString();
System.out.println(o1.equals(o3));
What is printed?

Correct Answer: D Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).
Which methods compile?

Correct Answer: A,D Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).
Given:
java
Runnable task1 = () -> System.out.println("Executing Task-1");
Callable<String> task2 = () -> {
System.out.println("Executing Task-2");
return "Task-2 Finish.";
};
ExecutorService execService = Executors.newCachedThreadPool();
// INSERT CODE HERE
execService.awaitTermination(3, TimeUnit.SECONDS);
execService.shutdownNow();
Which of the following statements, inserted in the code above, printsboth:
"Executing Task-2" and "Executing Task-1"?

Correct Answer: C,F Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).
Given:
java
package com.vv;
import java.time.LocalDate;
public class FetchService {
public static void main(String[] args) throws Exception {
FetchService service = new FetchService();
String ack = service.fetch();
LocalDate date = service.fetch();
System.out.println(ack + " the " + date.toString());
}
public String fetch() {
return "ok";
}
public LocalDate fetch() {
return LocalDate.now();
}
}
What will be the output?

Correct Answer: C Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).
Which of the following statements are correct?

Correct Answer: E Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).
What does the following code print?
java
import java.util.stream.Stream;
public class StreamReduce {
public static void main(String[] args) {
Stream<String> stream = Stream.of("J", "a", "v", "a");
System.out.print(stream.reduce(String::concat));
}
}

Correct Answer: C Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).
Which of the following statements oflocal variables declared with varareinvalid?(Choose 4)

Correct Answer: A,B,C,E Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).
Given:
java
Optional<String> optionalName = Optional.ofNullable(null);
String bread = optionalName.orElse("Baguette");
System.out.print("bread:" + bread);
String dish = optionalName.orElseGet(() -> "Frog legs");
System.out.print(", dish:" + dish);
try {
String cheese = optionalName.orElseThrow(() -> new Exception());
System.out.println(", cheese:" + cheese);
} catch (Exception exc) {
System.out.println(", no cheese.");
}
What is printed?

Correct Answer: D Vote an answer
Explanation: Only visible for Fast2test members. You can sign-up / login (it's free).

Contact Us

If you have any question please leave me your email address, we will reply and send email to you in 12 hours.

Our Working Time: ( GMT 0:00-15:00 ) From Monday to Saturday

Support: Contact now 

日本語 Deutsch 繁体中文 한국어