Special Summer Sale - 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: dm70dm

1z0-830 Java SE 21 Developer Professional Questions and Answers

Questions 4

Given:

java

DoubleSummaryStatistics stats1 = new DoubleSummaryStatistics();

stats1.accept(4.5);

stats1.accept(6.0);

DoubleSummaryStatistics stats2 = new DoubleSummaryStatistics();

stats2.accept(3.0);

stats2.accept(8.5);

stats1.combine(stats2);

System.out.println("Sum: " + stats1.getSum() + ", Max: " + stats1.getMax() + ", Avg: " + stats1.getAverage());

What is printed?

Options:

A.

Sum: 22.0, Max: 8.5, Avg: 5.5

B.

Sum: 22.0, Max: 8.5, Avg: 5.0

C.

An exception is thrown at runtime.

D.

Compilation fails.

Buy Now
Questions 5

Given:

java

var lyrics = """

Quand il me prend dans ses bras

Qu'il me parle tout bas

Je vois la vie en rose

""";

for ( int i = 0, int j = 3; i < j; i++ ) {

System.out.println( lyrics.lines()

.toList()

.get( i ) );

}

What is printed?

Options:

A.

vbnet

Quand il me prend dans ses bras

Qu'il me parle tout bas

Je vois la vie en rose

B.

Nothing

C.

An exception is thrown at runtime.

D.

Compilation fails.

Buy Now
Questions 6

Which of the followingisn'ta correct way to write a string to a file?

Options:

A.

java

Path path = Paths.get("file.txt");

byte[] strBytes = "Hello".getBytes();

Files.write(path, strBytes);

B.

java

try (BufferedWriter writer = new BufferedWriter("file.txt")) {

writer.write("Hello");

}

C.

java

try (FileOutputStream outputStream = new FileOutputStream("file.txt")) {

byte[] strBytes = "Hello".getBytes();

outputStream.write(strBytes);

}

D.

java

try (PrintWriter printWriter = new PrintWriter("file.txt")) {

printWriter.printf("Hello %s", "James");

}

E.

None of the suggestions

F.

java

try (FileWriter writer = new FileWriter("file.txt")) {

writer.write("Hello");

}

Buy Now
Questions 7

How would you create a ConcurrentHashMap configured to allow a maximum of 10 concurrent writer threads and an initial capacity of 42?

Which of the following options meets this requirement?

Options:

A.

var concurrentHashMap = new ConcurrentHashMap(42);

B.

None of the suggestions.

C.

var concurrentHashMap = new ConcurrentHashMap();

D.

var concurrentHashMap = new ConcurrentHashMap(42, 10);

E.

var concurrentHashMap = new ConcurrentHashMap(42, 0.88f, 10);

Buy Now
Questions 8

Given:

java

List l1 = new ArrayList<>(List.of("a", "b"));

List l2 = new ArrayList<>(Collections.singletonList("c"));

Collections.copy(l1, l2);

l2.set(0, "d");

System.out.println(l1);

What is the output of the given code fragment?

Options:

A.

[a, b]

B.

[d, b]

C.

[c, b]

D.

An UnsupportedOperationException is thrown

E.

An IndexOutOfBoundsException is thrown

F.

[d]

Buy Now
Questions 9

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?

Options:

A.

[Paris]

B.

[Paris, Toulouse]

C.

[Lille, Lyon]

D.

Compilation fails

E.

[Lyon, Lille, Toulouse]

Buy Now
Questions 10

Given:

java

interface SmartPhone {

boolean ring();

}

class Iphone15 implements SmartPhone {

boolean isRinging;

boolean ring() {

isRinging = !isRinging;

return isRinging;

}

}

Choose the right statement.

Options:

A.

Iphone15 class does not compile

B.

Everything compiles

C.

SmartPhone interface does not compile

D.

An exception is thrown at running Iphone15.ring();

Buy Now
Questions 11

Given:

java

var counter = 0;

do {

System.out.print(counter + " ");

} while (++counter < 3);

What is printed?

Options:

A.

0 1 2 3

B.

0 1 2

C.

1 2 3 4

D.

1 2 3

E.

An exception is thrown.

F.

Compilation fails.

Buy Now
Questions 12

Which methods compile?

Options:

A.

```java public List getListSuper() { return new ArrayList(); }

csharp

B.

```java

public List getListExtends() {

return new ArrayList();

}

C.

```java public List getListExtends() { return new ArrayList(); }

csharp

D.

```java

public List getListSuper() {

return new ArrayList();

}

Buy Now
Questions 13

A module com.eiffeltower.shop with the related sources in the src directory.

That module requires com.eiffeltower.membership, available in a JAR located in the lib directory.

What is the command to compile the module com.eiffeltower.shop?

Options:

A.

bash

CopyEdit

javac -source src -p lib/com.eiffel.membership.jar -d out -m com.eiffeltower.shop

B.

css

CopyEdit

javac --module-source-path src -p lib/com.eiffel.membership.jar -d out -m com.eiffeltower.shop

C.

css

CopyEdit

javac --module-source-path src -p lib/com.eiffel.membership.jar -s out -m com.eiffeltower.shop

D.

css

CopyEdit

javac -path src -p lib/com.eiffel.membership.jar -d out -m com.eiffeltower.shop

Buy Now
Questions 14

Given:

java

interface A {

default void ma() {

}

}

interface B extends A {

static void mb() {

}

}

interface C extends B {

void ma();

void mc();

}

interface D extends C {

void md();

}

interface E extends D {

default void ma() {

}

default void mb() {

}

default void mc() {

}

}

Which interface can be the target of a lambda expression?

Options:

A.

None of the above

B.

C

C.

A

D.

E

E.

B

F.

D

Buy Now
Questions 15

Given:

java

public class ThisCalls {

public ThisCalls() {

this(true);

}

public ThisCalls(boolean flag) {

this();

}

}

Which statement is correct?

Options:

A.

It does not compile.

B.

It throws an exception at runtime.

C.

It compiles.

Buy Now
Questions 16

Given:

var cabarets = new TreeMap<>();

cabarets.put(1, "Moulin Rouge");

cabarets.put(2, "Crazy Horse");

cabarets.put(3, "Paradis Latin");

cabarets.put(4, "Le Lido");

cabarets.put(5, "Folies Bergère");

System.out.println(cabarets.subMap(2, true, 5, false));

What is printed?

Options:

A.

CopyEdit

{2=Crazy Horse, 3=Paradis Latin, 4=Le Lido, 5=Folies Bergère}

B.

{2=Crazy Horse, 3=Paradis Latin, 4=Le Lido}

C.

{}

D.

An exception is thrown at runtime.

E.

Compilation fails.

Buy Now
Questions 17

Which of the following isn't a valid option of the jdeps command?

Options:

A.

--check-deps

B.

--generate-open-module

C.

--list-deps

D.

--generate-module-info

E.

--print-module-deps

F.

--list-reduced-deps

Buy Now
Questions 18

Given:

java

String s = " ";

System.out.print("[" + s.strip());

s = " hello ";

System.out.print("," + s.strip());

s = "h i ";

System.out.print("," + s.strip() + "]");

What is printed?

Options:

A.

[ ,hello,h i]

B.

[,hello,h i]

C.

[,hello,hi]

D.

[ , hello ,hi ]

Buy Now
Questions 19

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?

Options:

A.

MM d

B.

MM dd

C.

MMMM dd

D.

MMM dd

Buy Now
Questions 20

What do the following print?

java

public class DefaultAndStaticMethods {

public static void main(String[] args) {

WithStaticMethod.print();

}

}

interface WithDefaultMethod {

default void print() {

System.out.print("default");

}

}

interface WithStaticMethod extends WithDefaultMethod {

static void print() {

System.out.print("static");

}

}

Options:

A.

nothing

B.

default

C.

Compilation fails

D.

static

Buy Now
Questions 21

Given:

java

public class ExceptionPropagation {

public static void main(String[] args) {

try {

thrower();

System.out.print("Dom Pérignon, ");

} catch (Exception e) {

System.out.print("Chablis, ");

} finally {

System.out.print("Saint-Émilion");

}

}

static int thrower() {

try {

int i = 0;

return i / i;

} catch (NumberFormatException e) {

System.out.print("Rosé");

return -1;

} finally {

System.out.print("Beaujolais Nouveau, ");

}

}

}

What is printed?

Options:

A.

Saint-Émilion

B.

Beaujolais Nouveau, Chablis, Saint-Émilion

C.

Beaujolais Nouveau, Chablis, Dom Pérignon, Saint-Émilion

D.

Rosé

Buy Now
Questions 22

Given:

java

final Stream strings =

Files.readAllLines(Paths.get("orders.csv"));

strings.skip(1)

.limit(2)

.forEach(System.out::println);

And that the orders.csv file contains:

mathematica

OrderID,Customer,Product,Quantity,Price

1,Kylian Mbappé,Keyboard,2,25.50

2,Teddy Riner,Mouse,1,15.99

3,Sebastien Loeb,Monitor,1,199.99

4,Antoine Griezmann,Headset,3,45.00

What is printed?

Options:

A.

arduino

1,Kylian Mbappé,Keyboard,2,25.50

2,Teddy Riner,Mouse,1,15.99

3,Sebastien Loeb,Monitor,1,199.99

4,Antoine Griezmann,Headset,3,45.00

B.

arduino

1,Kylian Mbappé,Keyboard,2,25.50

2,Teddy Riner,Mouse,1,15.99

C.

arduino

2,Teddy Riner,Mouse,1,15.99

3,Sebastien Loeb,Monitor,1,199.99

D.

An exception is thrown at runtime.

E.

Compilation fails.

Buy Now
Questions 23

Given:

java

List cannesFestivalfeatureFilms = LongStream.range(1, 1945)

.boxed()

.toList();

try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {

cannesFestivalfeatureFilms.stream()

.limit(25)

.forEach(film -> executor.submit(() -> {

System.out.println(film);

}));

}

What is printed?

Options:

A.

Numbers from 1 to 25 sequentially

B.

Numbers from 1 to 25 randomly

C.

Numbers from 1 to 1945 randomly

D.

An exception is thrown at runtime

E.

Compilation fails

Buy Now
Questions 24

Given:

java

List integers = List.of(0, 1, 2);

integers.stream()

.peek(System.out::print)

.limit(2)

.forEach(i -> {});

What is the output of the given code fragment?

Options:

A.

Compilation fails

B.

An exception is thrown

C.

01

D.

012

E.

Nothing

Buy Now
Questions 25

Given:

java

List abc = List.of("a", "b", "c");

abc.stream()

.forEach(x -> {

x = x.toUpperCase();

});

abc.stream()

.forEach(System.out::print);

What is the output?

Options:

A.

abc

B.

An exception is thrown.

C.

Compilation fails.

D.

ABC

Buy Now
Exam Code: 1z0-830
Exam Name: Java SE 21 Developer Professional
Last Update: Mar 28, 2025
Questions: 84

PDF + Testing Engine

$49.5  $164.99

Testing Engine

$37.5  $124.99
buy now 1z0-830 testing engine

PDF (Q&A)

$31.5  $104.99
buy now 1z0-830 pdf
dumpsmate guaranteed to pass
24/7 Customer Support

DumpsMate's team of experts is always available to respond your queries on exam preparation. Get professional answers on any topic of the certification syllabus. Our experts will thoroughly satisfy you.

Site Secure

mcafee secure

TESTED 02 Apr 2025