Java MCQs with answers Page - 16

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 the below is invalid identifier with the main method?

  • (A) public
  • (B) static
  • (C) private
  • (D) final

A

Admin • 831.35K Points
Coach

Q. If an expression contains double, int, float, long, then the whole expression will be promoted into which of these data types?

  • (A) long
  • (B) int
  • (C) double
  • (D) float

A

Admin • 831.35K Points
Coach

Q. Which of these data type can be used for a method having a return statement in it?

  • (A) void
  • (B) int
  • (C) float
  • (D) both int and float

A

Admin • 831.35K Points
Coach

Q. Which of these is the method which is executed first before execution of any other thing takes place in a program?

  • (A) main method
  • (B) finalize method
  • (C) static method
  • (D) private method

A

Admin • 831.35K Points
Coach

Q. Which of these jump statements can skip processing the remainder of the code in its body for a particular iteration?

  • (A) break
  • (B) return
  • (C) exit
  • (D) continue

A

Admin • 831.35K Points
Coach

Q. What is the return type of a method that does not return any value?

  • (A) int
  • (B) float
  • (C) void
  • (D) double

A

Admin • 831.35K Points
Coach

Q. Which keyword is used by the method to refer to the object that invoked it?

  • (A) import
  • (B) catch
  • (C) abstract
  • (D) this

A

Admin • 831.35K Points
Coach

Q. Which of these method(s) is/are used for writing bytes to an outputstream?

  • (A) put()
  • (B) print() and write()
  • (C) printf()
  • (D) write() and read()

A

Admin • 831.35K Points
Coach

Q. What is the string contained in s after following lines of code?

Code:
StringBuffer s new StringBuffer("Hello"); s.deleteCharAt(0);
  • (A) Hell
  • (B) ello
  • (C) Hel
  • (D) llo

A

Admin • 831.35K Points
Coach

Q. Which exception is thrown by read() method?

  • (A) IOException
  • (B) InterruptedException
  • (C) SystemException
  • (D) SystemInputException

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