Weekend Special 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: Board70

1z0-830 Exam Dumps - Oracle Java SE Questions and Answers

Question # 4

Given:

java

String colors = "red\n" +

"green\n" +

"blue\n";

Which text block can replace the above code?

Options:

A.

java

String colors = """

red \

green\

blue \

""";

B.

java

String colors = """

red \s

green\s

blue \s

""";

C.

java

String colors = """

red \t

green\t

blue \t

""";

D.

java

String colors = """

red

green

blue

""";

E.

None of the propositions

Buy Now
Question # 5

Given:

java

Object input = 42;

String result = switch (input) {

case String s -> "It's a string with value: " + s;

case Double d -> "It's a double with value: " + d;

case Integer i -> "It's an integer with value: " + i;

};

System.out.println(result);

What is printed?

Options:

A.

null

B.

It's a string with value: 42

C.

It's a double with value: 42

D.

It's an integer with value: 42

E.

It throws an exception at runtime.

F.

Compilation fails.

Buy Now
Question # 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
Question # 7

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
Question # 8

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
Question # 9

Given:

java

var _ = 3;

var $ = 7;

System.out.println(_ + $);

What is printed?

Options:

A.

10

B.

_$

C.

It throws an exception.

D.

Compilation fails.

Buy Now
Question # 10

Given:

java

public class Test {

class A {

}

static class B {

}

public static void main(String[] args) {

// Insert here

}

}

Which three of the following are valid statements when inserted into the given program?

Options:

A.

A a = new A();

B.

B b = new Test.B();

C.

A a = new Test.A();

D.

B b = new Test().new B();

E.

B b = new B();

F.

A a = new Test().new A();

Buy Now
Question # 11

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

Options:

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 stream = Stream.builder().add("a").build();

G.

Stream stream = Stream.empty();

Buy Now
Question # 12

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
Question # 13

What does the following code print?

java

import java.util.stream.Stream;

public class StreamReduce {

public static void main(String[] args) {

Stream stream = Stream.of("J", "a", "v", "a");

System.out.print(stream.reduce(String::concat));

}

}

Options:

A.

Optional[Java]

B.

Java

C.

null

D.

Compilation fails

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

1z0-830 PDF

$25.5  $84.99
1z0-830 Engine

1z0-830 Testing Engine

$28.5  $94.99
1z0-830 PDF + Engine

1z0-830 PDF + Testing Engine

$40.5  $134.99