Oracle
1Z0-809 · Question #244
Given the code fragments: public class Test { List<String> list = null; public void printValues() { System.out.print(getList()); } public List<String> getList() { return list; } public void…
The correct answer is D. [Dog, Cat, Mouse]. You've hit your session limit · resets 5:20pm (America/New_York)
Question
Given the code fragments:
public class Test {
List<String> list = null;
public void printValues() {
System.out.print(getList());
}
public List<String> getList() { return list; }
public void setList(List<String> newList) { list = newList; }
}
and
List<String> li = Arrays.asList("Dog", "Cat", "Mouse");
Test t = new Test();
t.setList(li.stream().collect(Collectors.toList()));
t.getList().forEach(Test::printValues);
What is the result?
Options
- Anull
- BA compilation error occurs.
- CDogCatMouse
- D[Dog, Cat, Mouse]
How the community answered
(53 responses)- A2% (1)
- B9% (5)
- C6% (3)
- D83% (44)
Explanation
You've hit your session limit · resets 5:20pm (America/New_York)
Community Discussion
No community discussion yet for this question.