Explanation: `ArrayList::new` is a constructor reference to create a new `ArrayList` instance.
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: `ArrayList::new` is a constructor reference to create a new `ArrayList` instance.
Explanation: Method references can replace lambdas that invoke a method directly.
Explanation: `String::valueOf` converts primitives and objects to their string representation.
Explanation: `Arrays::sort` refers to a static method.
Explanation: `String::length` is an instance method of an arbitrary `String` object.
Explanation: Static methods must be referenced by class name, not object name.
Explanation: String::trim removes leading and trailing spaces.
Explanation: Supplier provides instances via a no-arg constructor.
Explanation: Method references are a feature of Java 8.
Explanation: Overloaded methods can be referenced if the functional interface signature resolves to the correct method.