Explanation: `System.out::println` prints each element when used in forEach or streams.
Dear candidates you will find MCQ questions of JAVA here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question
Explanation: `System.out::println` prints each element when used in forEach or streams.
Explanation: `ClassName::new` is a constructor reference used with Supplier.
Explanation: If `compareByName` is a static method, it can be used as `Employee::compareByName`.
Explanation: `String::compareTo` is used for natural ordering of strings.
Explanation: `Employee::getName` refers to an instance method of arbitrary objects of Employee.
Explanation: Supplier represents a no-argument constructor reference.
Explanation: `Math::abs` converts numbers to their absolute values.
Explanation: `String::trim` is used to remove leading and trailing spaces.
Explanation: `Object::toString` returns the string representation of an object.
Explanation: However, there is no direct method reference for negation; still, this lambda form is often used.