Spring Sale Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: buysanta

Exact2Pass Menu

Java SE 21 Developer Professional

Last Update 4 hours ago Total Questions : 84

The Java SE 21 Developer Professional content is now fully updated, with all current exam questions added 4 hours ago. Deciding to include 1z0-830 practice exam questions in your study plan goes far beyond basic test preparation.

You'll find that our 1z0-830 exam questions frequently feature detailed scenarios and practical problem-solving exercises that directly mirror industry challenges. Engaging with these 1z0-830 sample sets allows you to effectively manage your time and pace yourself, giving you the ability to finish any Java SE 21 Developer Professional practice test comfortably within the allotted time.

Question # 21

Given:

java

sealed class Vehicle permits Car, Bike {

}

non-sealed class Car extends Vehicle {

}

final class Bike extends Vehicle {

}

public class SealedClassTest {

public static void main(String[] args) {

Class < ? > vehicleClass = Vehicle.class;

Class < ? > carClass = Car.class;

Class < ? > bikeClass = Bike.class;

System.out.print("Is Vehicle sealed? " + vehicleClass.isSealed() +

"; Is Car sealed? " + carClass.isSealed() +

"; Is Bike sealed? " + bikeClass.isSealed());

}

}

What is printed?

A.

Is Vehicle sealed? true; Is Car sealed? true; Is Bike sealed? true

B.

Is Vehicle sealed? false; Is Car sealed? false; Is Bike sealed? false

C.

Is Vehicle sealed? true; Is Car sealed? false; Is Bike sealed? false

D.

Is Vehicle sealed? false; Is Car sealed? true; Is Bike sealed? true

Question # 22

Which StringBuilder variable fails to compile?

java

public class StringBuilderInstantiations {

public static void main(String[] args) {

var stringBuilder1 = new StringBuilder();

var stringBuilder2 = new StringBuilder(10);

var stringBuilder3 = new StringBuilder("Java");

var stringBuilder4 = new StringBuilder(new char[]{'J', 'a', 'v', 'a'});

}

}

A.

None of them

B.

stringBuilder4

C.

stringBuilder1

D.

stringBuilder3

E.

stringBuilder2

Question # 23

Given:

java

DoubleStream doubleStream = DoubleStream.of(3.3, 4, 5.25, 6.66);

Predicate < Double > doublePredicate = d - > d < 5;

System.out.println(doubleStream.anyMatch(doublePredicate));

What is printed?

A.

Compilation fails

B.

true

C.

false

D.

An exception is thrown at runtime

E.

3.3

Question # 24

Given:

java

String textBlock = """

j \

a \t

v \s

a \

""";

System.out.println(textBlock.length());

What is the output?

A.

11

B.

12

C.

14

D.

10

Question # 25

Given:

java

void verifyNotNull(Object input) {

boolean enabled = false;

assert enabled = true;

assert enabled;

System.out.println(input.toString());

assert input != null;

}

When does the given method throw a NullPointerException?

A.

A NullPointerException is never thrown

B.

Only if assertions are enabled and the input argument is null

C.

Only if assertions are disabled and the input argument is null

D.

Only if assertions are enabled and the input argument isn't null

E.

Only if assertions are disabled and the input argument isn't null

Go to page: