Exam Name: | Java SE 21 Developer Professional | ||
Exam Code: | 1z0-830 Dumps | ||
Vendor: | Oracle | Certification: | Java SE |
Questions: | 84 Q&A's | Shared By: | ryley |
Given:
java
Optional o1 = Optional.empty();
Optional o2 = Optional.of(1);
Optional o3 = Stream.of(o1, o2)
.filter(Optional::isPresent)
.findAny()
.flatMap(o -> o);
System.out.println(o3.orElse(2));
What is the given code fragment's output?
Given:
java
var frenchCities = new TreeSet
frenchCities.add("Paris");
frenchCities.add("Marseille");
frenchCities.add("Lyon");
frenchCities.add("Lille");
frenchCities.add("Toulouse");
System.out.println(frenchCities.headSet("Marseille"));
What will be printed?
Given:
java
Period p = Period.between(
LocalDate.of(2023, Month.MAY, 4),
LocalDate.of(2024, Month.MAY, 4));
System.out.println(p);
Duration d = Duration.between(
LocalDate.of(2023, Month.MAY, 4),
LocalDate.of(2024, Month.MAY, 4));
System.out.println(d);
What is the output?
Given:
java
var counter = 0;
do {
System.out.print(counter + " ");
} while (++counter < 3);
What is printed?