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

1z0-830 Exam Dumps - Java SE 21 Developer Professional

Go to page:
Question # 17

Which of the following can be the body of a lambda expression?

A.

Two statements

B.

An expression and a statement

C.

A statement block

D.

None of the above

E.

Two expressions

Full Access
Question # 18

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));

A.

C:

B.

IllegalArgumentException

C.

C

D.

Compilation error

E.

home

Full Access
Question # 19

Given:

java

System.out.print(Boolean.logicalAnd(1 == 1, 2 < 1));

System.out.print(Boolean.logicalOr(1 == 1, 2 < 1));

System.out.print(Boolean.logicalXor(1 == 1, 2 < 1));

What is printed?

A.

truetruefalse

B.

falsetruetrue

C.

truefalsetrue

D.

truetruetrue

E.

Compilation fails

Full Access
Question # 20

Given a properties file on the classpath named Person.properties with the content:

ini

name=James

And:

java

public class Person extends ListResourceBundle {

protected Object[][] getContents() {

return new Object[][]{

{"name", "Jeanne"}

};

}

}

And:

java

public class Test {

public static void main(String[] args) {

ResourceBundle bundle = ResourceBundle.getBundle("Person");

String name = bundle.getString("name");

System.out.println(name);

}

}

What is the given program's output?

A.

MissingResourceException

B.

Compilation fails

C.

James

D.

JeanneJames

E.

JamesJeanne

F.

Jeanne

Full Access
Question # 21

Given:

java

public class Test {

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

Path p1 = Path.of("f1.txt");

Path p2 = Path.of("f2.txt");

Files.move(p1, p2);

Files.delete(p1);

}

}

In which case does the given program throw an exception?

A.

Neither files f1.txt nor f2.txt exist

B.

Both files f1.txt and f2.txt exist

C.

An exception is always thrown

D.

File f2.txt exists while file f1.txt doesn't

E.

File f1.txt exists while file f2.txt doesn't

Full Access
Question # 22

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?

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);

Full Access
Question # 23

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?

A.

Saint-Émilion

B.

Beaujolais Nouveau, Chablis, Saint-Émilion

C.

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

D.

Rosé

Full Access
Question # 24

Given:

java

var _ = 3;

var $ = 7;

System.out.println(_ + $);

What is printed?

A.

10

B.

_$

C.

It throws an exception.

D.

Compilation fails.

Full Access
Go to page: