Summer Sale Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: ecus65

Oracle 1z0-830 - Java SE 21 Developer Professional

Page: 3 / 3
Total 84 questions

Given:

java

public class BoomBoom implements AutoCloseable {

public static void main(String[] args) {

try (BoomBoom boomBoom = new BoomBoom()) {

System.out.print("bim ");

throw new Exception();

} catch (Exception e) {

System.out.print("boom ");

}

}

@Override

public void close() throws Exception {

System.out.print("bam ");

throw new RuntimeException();

}

}

What is printed?

A.

bim boom bam

B.

bim bam boom

C.

bim boom

D.

bim bam followed by an exception

E.

Compilation fails.

Which of the following java.io.Console methods doesnotexist?

A.

read()

B.

reader()

C.

readLine()

D.

readLine(String fmt, Object... args)

E.

readPassword()

F.

readPassword(String fmt, Object... args)

Consider the following methods to load an implementation of MyService using ServiceLoader. Which of the methods are correct? (Choose all that apply)

A.

MyService service = ServiceLoader.load(MyService.class).iterator().next();

B.

MyService service = ServiceLoader.load(MyService.class).findFirst().get();

C.

MyService service = ServiceLoader.getService(MyService.class);

D.

MyService service = ServiceLoader.services(MyService.class).getFirstInstance();

Given:

java

var ceo = new HashMap<>();

ceo.put("Sundar Pichai", "Google");

ceo.put("Tim Cook", "Apple");

ceo.put("Mark Zuckerberg", "Meta");

ceo.put("Andy Jassy", "Amazon");

Does the code compile?

A.

True

B.

False

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?

A.

None of the above

B.

C

C.

A

D.

E

E.

B

F.

D