1z1-830試験無料問題集「Oracle Java SE 21 Developer Professional 認定」

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

解説: (GoShiken メンバーにのみ表示されます)
Given:
java
DoubleSummaryStatistics stats1 = new DoubleSummaryStatistics();
stats1.accept(4.5);
stats1.accept(6.0);
DoubleSummaryStatistics stats2 = new DoubleSummaryStatistics();
stats2.accept(3.0);
stats2.accept(8.5);
stats1.combine(stats2);
System.out.println("Sum: " + stats1.getSum() + ", Max: " + stats1.getMax() + ", Avg: " + stats1.getAverage()); What is printed?

解説: (GoShiken メンバーにのみ表示されます)
Given:
java
StringBuffer us = new StringBuffer("US");
StringBuffer uk = new StringBuffer("UK");
Stream<StringBuffer> stream = Stream.of(us, uk);
String output = stream.collect(Collectors.joining("-", "=", ""));
System.out.println(output);
What is the given code fragment's output?

解説: (GoShiken メンバーにのみ表示されます)
Which of the following suggestions compile?(Choose two.)

解説: (GoShiken メンバーにのみ表示されます)
Which of the following doesnotexist?

解説: (GoShiken メンバーにのみ表示されます)
Given:
java
var lyrics = """
Quand il me prend dans ses bras
Qu'il me parle tout bas
Je vois la vie en rose
""";
for ( int i = 0, int j = 3; i < j; i++ ) {
System.out.println( lyrics.lines()
.toList()
.get( i ) );
}
What is printed?

解説: (GoShiken メンバーにのみ表示されます)
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?

解説: (GoShiken メンバーにのみ表示されます)
Given:
java
String colors = "red\n" +
"green\n" +
"blue\n";
Which text block can replace the above code?

解説: (GoShiken メンバーにのみ表示されます)