Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam 1z0-809 topic 1 question 128 discussion

Actual exam question from Oracle's 1z0-809
Question #: 128
Topic #: 1
[All 1z0-809 Questions]

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+ "; ");};
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️
Reference:
https://www.concretepage.com/java/jdk-8/java-8-biconsumer-bifunction-bipredicate-example

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
pul26
Highly Voted 3 years, 4 months ago
Answer is A
upvoted 11 times
...
sansay61
Highly Voted 3 years, 3 months ago
Function has an apply method. So its not b. Also biconsumer has <t,t> signature. So the answer is A
upvoted 9 times
...
steefaand
Most Recent 2 months, 1 week ago
Selected Answer: A
A is correct since forEach accepts Consumer or BiConsumer.
upvoted 1 times
...
duydn
6 months, 4 weeks ago
Selected Answer: A
A is correct. Function use apply(), Consumer use accept(). Function<T, R> -> return R Consumer<T> -> void
upvoted 1 times
...
shifasaleem
1 year, 4 months ago
Answer is A
upvoted 1 times
...
lchowen
1 year, 7 months ago
forEach accepts Consumer or BiConsumer so B is definitely not correct. Answer is A
upvoted 1 times
...
WilsonKKerll
2 years ago
Selected Answer: A
Answer is A.
upvoted 1 times
...
jduarte
3 years ago
Answer is A. Tested.
upvoted 5 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...