1z0-809 question 128 discussion

View all Java SE 8 Programmer II Exam here
back to oracle forum

Question 128

Given the code fragment:

Which statement can be inserted into line n1 to print 1,2; 1,10; 2,20;?

  • A. BiConsumer<Integer,Integer> c = (i, j) -> {System.out.print (i + “,” + j+ “; “);};
  • B. BiFunction<Integer, Integer, String> c = (i, j) –> {System.out.print (i + “,” + j+ “; “)};
  • C. BiConsumer<Integer, Integer, String> c = (i, j) –> {System.out.print (i + “,” + j+ “; “)};
  • D. BiConsumer<Integer, Integer, Integer> c = (i, j) –> {System.out.print (i + “,” + j+ “; “);};
Answer:

B


Explanation:
References:

User Votes:
A 2 votes
50%
B
50%
C
50%
D
50%
Discussions
0 / 1000
vidhya
6 months, 3 weeks ago

option A because option B returns something. we dont need any returns

vidhya
6 months, 3 weeks ago

acccept is an consumer method