Java MCQs with answers Page - 474

Here, you will find a collection of MCQ questions on Java. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 832.27K Points
Coach

Q. Method references can be used with which Java API feature extensively?

  • (A) I/O API
  • (B) Reflection
  • (C) Streams API
  • (D) Security API

A

Admin • 832.27K Points
Coach

Q. What is the syntax for a method reference to the current instance's method?

  • (A) ClassName::method
  • (B) this::method
  • (C) super::method
  • (D) new::method

A

Admin • 832.27K Points
Coach

Q. What does `super::method` represent?

  • (A) Static method reference
  • (B) Superclass method reference
  • (C) Constructor reference
  • (D) Field reference

A

Admin • 832.27K Points
Coach

Q. Is `ClassName::fieldName` a valid method reference?

  • (A) Yes
  • (B) No
  • (C) Only if field is static
  • (D) Only with Supplier

A

Admin • 832.27K Points
Coach

Q. Which operator is used in method reference syntax?

  • (A) ::
  • (B) ->
  • (C) =>
  • (D) **

A

Admin • 832.27K Points
Coach

Q. Which interface does `Supplier<ClassName>` match with?

  • (A) ClassName::methodName
  • (B) ClassName::new
  • (C) new ClassName()
  • (D) ClassName.methodName()

A

Admin • 832.27K Points
Coach

Q. Method references are available from which Java version?

  • (A) Java 6
  • (B) Java 7
  • (C) Java 8
  • (D) Java 9

A

Admin • 832.27K Points
Coach

Q. Which method reference can replace `x -> x.toString()`?

  • (A) Object::toString
  • (B) String::valueOf
  • (C) String::substring
  • (D) Integer::parseInt

A

Admin • 832.27K Points
Coach

Q. Which method reference is valid for invoking an instance method on a particular object?

  • (A) ClassName::methodName
  • (B) objectName::methodName
  • (C) ClassName::new
  • (D) this::methodName

A

Admin • 832.27K Points
Coach

Q. Which of these is NOT a valid form of method reference?

  • (A) ClassName::staticMethodName
  • (B) ClassName::instanceMethodName
  • (C) objectName::instanceMethodName
  • (D) ClassName::fieldName

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ