1Z0-829 Method Reference Practice Question
Which are valid method references in Java 17?
⚠ Common exam trap
A common trap is incorrectly excluding constructor references like String::new, assuming they are not method references. Another trap is considering null::equals valid, but null cannot be a qualifier. Some may incorrectly think this::toString is invalid, but it is valid in an instance context.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
String::new
A is a constructor reference, a valid type of method reference. B is a reference to an instance method of an arbitrary object of type String. D is a reference to a static method. E is a reference to an instance method of the current object, valid in an instance context. C is invalid because null cannot be a qualifier.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
String::new
Why this is correct
Valid constructor reference, equivalent to () -> new String().
- ✓
String::isEmpty
Why this is correct
Valid instance method reference, equivalent to (String s) -> s.isEmpty().
- ✗
null::equals
Why it's wrong here
Invalid because null is not a valid qualifier for a method reference.
- ✓
Math::random
Why this is correct
Valid static method reference, matching functional interfaces like Supplier<Double>.
- ✓
this::toString
Why this is correct
Valid method reference to an instance method of the current object, usable in instance methods.
Go deeper
Related to this question
About these practice questions
One of 513 original 1Z0-829 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 1Z0-829 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-829 exam.