ExamDumpster

Free 1Z0-830 sample questions

Real questions from the Java SE 21 Developer Professional practice bank, with the correct answer and an explanation for each one. No junk, no filler.

Try them in the simulator Same questions, with study, timed and flashcard modes.

Showing 8 of 17 free sample questions.

Question 1Choose one

A financial application uses a sealed interface `Transaction` to represent various payment methods. The interface permits three record classes: `CreditCard`, `BankTransfer`, and `DigitalWallet`. You are writing a method to process these transactions using a switch expression with pattern matching. ```java public sealed interface Transaction permits CreditCard, BankTransfer, DigitalWallet {} public record CreditCard(String pan, double amount) implements Transaction {} public record BankTransfer(String iban, double amount) implements Transaction {} public record DigitalWallet(String id, double amount) implements Transaction {} // In a service class: public String process(Transaction t) { return switch(t) { case CreditCard c when c.amount > 1000 -> "High Value CC"; case CreditCard c -> "Standard CC"; case BankTransfer b -> "Bank Transfer"; // Missing case }; } ``` Which statement is true regarding the compilation of this code?

Question 2Choose one

You are developing a high-throughput web server using Java 21's Virtual Threads. You need to protect a shared resource using a locking mechanism. However, you want to avoid 'pinning' the virtual thread to the carrier thread, which can degrade performance during blocking operations. Which locking approach should you prefer?

Question 3Choose one

Review the following code snippet that uses the new Sequenced Collections API introduced in Java 21: ```java import java.util.*; public class SequenceTest { public static void main(String[] args) { SequencedCollection sc = new ArrayList (); sc.addFirst("Alpha"); sc.addLast("Omega"); sc.addFirst("Beta"); System.out.println(sc.getFirst() + "-" + sc.getLast()); System.out.println(sc.reversed()); } } ``` What is the output of this program?

Question 4Choose 2

Which of the following are valid characteristics of Java records? (Select TWO)

Question 5Choose one

You are implementing a module descriptor `module-info.java` for a library named `com.example.lib`. You need to ensure that the package `com.example.lib.internal` is accessible via reflection to a specific testing framework module `com.test.framework`, but not accessible to other modules at compile time or runtime. Which directive should you use?

Question 6Choose one

Consider the following Text Block usage in Java 21: ```java String html = """ Hello, World """; ``` If the opening `"""` is on line 1, and the closing `"""` is indented to align with the start of ` `, how many spaces of indentation are removed from the ` ` tag line?

Question 7Choose one

True or False: In Java 21, creating a `Virtual Thread` requires implementing a specific sub-interface of `Runnable`.

Question 8Choose one

You need to perform a calculation using `java.time.Duration`. You have a start time `t1` and end time `t2` (both `Instant`). You want to calculate the number of whole days between them. Which code snippet correctly achieves this?

9 more free samples are waiting

Create a free account to unlock the whole 1Z0-830 sample bank, or get full access to all 254 practice questions in the simulator.

Create account