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 # 11

Which of the following statements is correct about a final class?

A.

The final keyword in its declaration must go right before the class keyword.

B.

It must contain at least a final method.

C.

It cannot be extended by any other class.

D.

It cannot implement any interface.

E.

It cannot extend another class.

Question # 12

Given:

java

double amount = 42_000.00;

NumberFormat format = NumberFormat.getCompactNumberInstance(Locale.FRANCE, NumberFormat.Style.SHORT);

System.out.println(format.format(amount));

What is the output?

A.

42000E

B.

42 000,00 €

C.

42000

D.

42 k

Question # 13

Which two of the following aren't the correct ways to create a Stream?

A.

Stream stream = Stream.of("a");

B.

Stream stream = Stream.ofNullable("a");

C.

Stream stream = Stream.generate(() - > "a");

D.

Stream stream = Stream.of();

E.

Stream stream = new Stream();

F.

Stream < String > stream = Stream.builder().add("a").build();

G.

Stream stream = Stream.empty();

Question # 14

Given:

java

public static void main(String[] args) {

try {

throw new IOException();

} catch (IOException e) {

throw new RuntimeException();

} finally {

throw new ArithmeticException();

}

}

What is the output?

A.

Compilation fails

B.

IOException

C.

RuntimeException

D.

ArithmeticException

Question # 15

Given:

java

import java.io.*;

class A implements Serializable {

int number = 1;

}

class B implements Serializable {

int number = 2;

}

public class Test {

public static void main(String[] args) throws Exception {

File file = new File("o.ser");

A a = new A();

var oos = new ObjectOutputStream(new FileOutputStream(file));

oos.writeObject(a);

oos.close();

var ois = new ObjectInputStream(new FileInputStream(file));

B b = (B) ois.readObject();

ois.close();

System.out.println(b.number);

}

}

What is the given program's output?

A.

1

B.

2

C.

Compilation fails

D.

ClassCastException

E.

NotSerializableException

Question # 16

Given:

java

Optional < String > optionalName = Optional.ofNullable(null);

String bread = optionalName.orElse("Baguette");

System.out.print("bread:" + bread);

String dish = optionalName.orElseGet(() - > "Frog legs");

System.out.print(", dish:" + dish);

try {

String cheese = optionalName.orElseThrow(() - > new Exception());

System.out.println(", cheese:" + cheese);

} catch (Exception exc) {

System.out.println(", no cheese.");

}

What is printed?

A.

bread:Baguette, dish:Frog legs, cheese.

B.

bread:Baguette, dish:Frog legs, no cheese.

C.

bread:bread, dish:dish, cheese.

D.

Compilation fails.

Question # 17

Given:

java

List < String > frenchAuthors = new ArrayList < > ();

frenchAuthors.add("Victor Hugo");

frenchAuthors.add("Gustave Flaubert");

Which compiles?

A.

Map <</b> String, ArrayList <</b> String > > authorsMap1 = new HashMap <</b> > ();

java

authorsMap1.put("FR", frenchAuthors);

B.

Map <</b> String, ? extends List <</b> String > > authorsMap2 = new HashMap <</b> String, ArrayList <</b> String > > ();

java

authorsMap2.put("FR", frenchAuthors);

C.

var authorsMap3 = new HashMap <</b> > ();

java

authorsMap3.put("FR", frenchAuthors);

D.

Map <</b> String, List <</b> String > > authorsMap4 = new HashMap <</b> String, ArrayList <</b> String > > ();

java

authorsMap4.put("FR", frenchAuthors);

E.

Map <</b> String, List <</b> String > > authorsMap5 = new HashMap <</b> String, List <</b> String > > ();

java

authorsMap5.put("FR", frenchAuthors);

Question # 18

Which of the following methods of java.util.function.Predicate are default methods ?

A.

and(Predicate <</b> ? super T > other)

B.

isEqual(Object targetRef)

C.

negate()

D.

not(Predicate <</b> ? super T > target)

E.

or(Predicate <</b> ? super T > other)

F.

test(T t)

Question # 19

Given:

java

List < Long > 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?

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

Question # 20

Given:

java

var array1 = new String[]{ "foo", "bar", "buz" };

var array2[] = { "foo", "bar", "buz" };

var array3 = new String[3] { "foo", "bar", "buz" };

var array4 = { "foo", "bar", "buz" };

String array5[] = new String[] { "foo", "bar", "buz" };

Which arrays compile? (Select 2)

A.

array1

B.

array2

C.

array3

D.

array4

E.

array5

Go to page: