Java MCQs with answers Page - 11

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 • 831.35K Points
Coach

Q. Which of these is correct way of inheriting class A by class B?

  • (A) class B + class A {}
  • (B) class B inherits class A {}
  • (C) class B extends A {}
  • (D) class B extends class A {}

A

Admin • 831.35K Points
Coach

Q. Which of the following are true about interfaces.

  • (A) Methods declared in interfaces are implicitly private.
  • (B) Variables declared in interfaces are implicitly public, static, and final.
  • (C) An interface contains any number of method definitions.
  • (D) The keyword implements indicate that an interface inherits from another.

A

Admin • 831.35K Points
Coach

Q. Which of these keywords is used to define interfaces in Java?

  • (A) interface
  • (B) Interface
  • (C) intf
  • (D) implements

A

Admin • 831.35K Points
Coach

Q. Which of these can be used to fully abstract a class from its implementation?

  • (A) Objects
  • (B) Packages
  • (C) Interfaces
  • (D) None of the Mentione

A

Admin • 831.35K Points
Coach

Q. Which of these access specifiers can be used for an interface?

  • (A) Public
  • (B) Protected
  • (C) private
  • (D) All of the mentioned

A

Admin • 831.35K Points
Coach

Q. Which of these keywords is used by a class to use an interface defined previously?

  • (A) import
  • (B) Import
  • (C) implements
  • (D) Implements

A

Admin • 831.35K Points
Coach

Q. Which of the following is correct way of implementing an interface salary by class manager?

  • (A) class Manager extends salary {}
  • (B) class Manager implements salary {}
  • (C) class Manager imports salary {}
  • (D) None of the mentioned

A

Admin • 831.35K Points
Coach

Q. The keyword used to create a package is

  • (A) import
  • (B) package
  • (C) classpath
  • (D) public

A

Admin • 831.35K Points
Coach

Q. The modifier which specifies that the member can only be accessed in its own class is

  • (A) public
  • (B) private
  • (C) protected
  • (D) none

A

Admin • 831.35K Points
Coach

Q. Which of the following package stores all the standard java classes?

  • (A) lang
  • (B) java
  • (C) java.util
  • (D) java.packages

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