1z1-830 無料問題集「Oracle Java SE 21 Developer Professional」
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?
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?
正解:F
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
Given:
java
var array1 = new String[]{ "foo", "bar", "buz" };
var array2[] = { "foo", "bar", "buz" };
var array3 = new String[3] { "foo", "bar", "buz" };
var array4 = { "foo", "bar", "buz" };
String array5[] = new String[]{ "foo", "bar", "buz" };
Which arrays compile? (Select 2)
java
var array1 = new String[]{ "foo", "bar", "buz" };
var array2[] = { "foo", "bar", "buz" };
var array3 = new String[3] { "foo", "bar", "buz" };
var array4 = { "foo", "bar", "buz" };
String array5[] = new String[]{ "foo", "bar", "buz" };
Which arrays compile? (Select 2)
正解:D、E
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)
Given:
java
var deque = new ArrayDeque<>();
deque.add(1);
deque.add(2);
deque.add(3);
deque.add(4);
deque.add(5);
System.out.print(deque.peek() + " ");
System.out.print(deque.poll() + " ");
System.out.print(deque.pop() + " ");
System.out.print(deque.element() + " ");
What is printed?
java
var deque = new ArrayDeque<>();
deque.add(1);
deque.add(2);
deque.add(3);
deque.add(4);
deque.add(5);
System.out.print(deque.peek() + " ");
System.out.print(deque.poll() + " ");
System.out.print(deque.pop() + " ");
System.out.print(deque.element() + " ");
What is printed?
正解:B
解答を投票する
解説: (JPNTest メンバーにのみ表示されます)