Free 1z0-830 Exam Dumps

Question 16

Given: java
String textBlock = """ j
a t v s a """;
System.out.println(textBlock.length()); What is the output?

Correct Answer:B

Question 17

Given: java
public class Test { static int count;
synchronized Test() { count++;
}
public static void main(String[] args) throws InterruptedException { Runnable task = Test::new;
Thread t1 = new Thread(task); Thread t2 = new Thread(task);
t1.start();
t2.start();
t1.join();
t2.join(); System.out.println(count);
}
}
What is the given program's output?

Correct Answer:E

Question 18

Given: java
Stream strings = Stream.of("United", "States"); BinaryOperator operator = (s1, s2) -> s1.concat(s2.toUpperCase()); String result = strings.reduce("-", operator);
System.out.println(result);
What is the output of this code fragment?

Correct Answer:F

Question 19

Which of the following suggestions compile?(Choose two.)

Correct Answer:AD

Question 20

Given: java
interface Calculable { long calculate(int i);
}
public class Test {
public static void main(String[] args) { Calculable c1 = i -> i + 1; // Line 1 Calculable c2 = i -> Long.valueOf(i); // Line 2
Calculable c3 = i -> { throw new ArithmeticException(); }; // Line 3
}
}
Which lines fail to compile?

Correct Answer:G