1z0-830 Dumps

1z0-830 Free Practice Test

Oracle 1z0-830: Java SE 21 Developer Professional

QUESTION 6

What is the output of the following snippet? (Assume the file exists) java
Path path = Paths.get("C:\home\joe\foo"); System.out.println(path.getName(0));

Correct Answer: E

QUESTION 7

Given: java
var now = LocalDate.now();
var format1 = new DateTimeFormatter(ISO_WEEK_DATE); var format2 = DateTimeFormatter.ISO_WEEK_DATE;
var format3 = new DateFormat(WEEK_OF_YEAR_FIELD);
var format4 = DateFormat.getDateInstance(WEEK_OF_YEAR_FIELD);
System.out.println(now.format(REPLACE_HERE));
Which variable prints 2025-W01-2 (present-day is 12/31/2024)?

Correct Answer: B

QUESTION 8

Given: java
interface Calculable { long calculate(int i);
}
public class Test {
public static void main(String[] args) { Calculable c1 = i -> i + 1; // Line 1 Calculable c2 = i -> Long.valueOf(i); // Line 2
Calculable c3 = i -> { throw new ArithmeticException(); }; // Line 3
}
}
Which lines fail to compile?

Correct Answer: G

QUESTION 9

Given: java
LocalDate localDate = LocalDate.of(2020, 8, 8); Date date = java.sql.Date.valueOf(localDate);
DateFormat formatter = new SimpleDateFormat(/* pattern */); String output = formatter.format(date); System.out.println(output);
It's known that the given code prints out "August 08". Which of the following should be inserted as the pattern?

Correct Answer: C

QUESTION 10

What do the following print? java
import java.time.Duration;
public class DividedDuration {
public static void main(String[] args) { var day = Duration.ofDays(2); System.out.print(day.dividedBy(8));
}
}

Correct Answer: A