Java MCQs with answers
4,796 java multiple choice questions with the correct answer and a short explanation for each. Last updated 22 Jul 2025. Showing page 3 of 240.
- In which Java version were method references introduced?
- Which interface is typically used with `ClassName::new` to provide objects?
- What is returned by `Function<String, String> f = String::trim;` when applied to " Hello "?
- Is `object::staticMethod` a valid method reference?
- Which method reference form would match `Function<String, Integer> length = String::length;`?
- What kind of reference is `Arrays::sort`?
- Which is the correct method reference for `String::valueOf`?
- In which scenario can method references replace a lambda?
- Which is a valid method reference for creating a new `ArrayList`?
- What does `super::methodName` refer to?
- Method references require the functional interface to match in:
- Which method reference is equivalent to `(list, e) -> list.add(e)`?
- Which method reference replaces `s -> s.isEmpty()`?
- Which functional interface matches with `String::new` when used with a Supplier?
- What type of method reference is `this::equals`?
- Given `Comparator<String> comp = String::compareToIgnoreCase;`, what does the method reference resolve to?
- Which of these is NOT a valid form of method reference?
- Which method reference is valid for invoking an instance method on a particular object?
- Which method reference can replace `x -> x.toString()`?
- Method references are available from which Java version?
About the Java question set
These questions are contributed by users and published after review. Each page shows all four options, the correct answer and an explanation, so you can revise a topic in a few minutes. Start from page one for the newest additions, or open any question and use the topic tags under it to reach related sets.