Java MCQ Questions and Answers | Core Java Objective Questions

Telegram Group Join Now
WhatsApp Group Join Now

Java is one of the most popular programming languages used in software development, competitive exams, and technical interviews. Java MCQ questions are commonly asked in exams, college tests, and placement interviews, making this topic very important for students and job aspirants.

In this blog post, we provide a well-organized collection of Java MCQ Questions and Answers to help beginners and experienced learners revise core Java concepts quickly. This content is designed especially for students, competitive exam aspirants, and interview candidates who want to strengthen their Java fundamentals.

Java MCQ Questions

1. Java is a:

  • A) Procedure-oriented language
  • B) Object-oriented language
  • C) Assembly language
  • D) Markup language
Correct Answer: B
Explanation: Java is a purely object-oriented programming language (except primitive data types).

2. Which company originally developed Java?

  • A) Microsoft
  • B) Oracle
  • C) Sun Microsystems
  • D) IBM
Correct Answer: C
Explanation: Java was originally developed by Sun Microsystems.

3. Which keyword is used to define a class in Java?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) class
  • B) define
  • C) struct
  • D) new
Correct Answer: A
Explanation: The class keyword is used to define a class in Java.

4. Which of the following is not a Java feature?

  • A) Platform independent
  • B) Object-oriented
  • C) Use of pointers
  • D) Secure
Correct Answer: C
Explanation: Java does not support pointers to ensure security.

5. Java programs are compiled into:

  • A) Machine code
  • B) Bytecode
  • C) Assembly code
  • D) Source code
Correct Answer: B
Explanation: Java compiler converts source code into bytecode.

6. Which method is the entry point of a Java program?

  • A) start()
  • B) run()
  • C) main()
  • D) init()
Correct Answer: C
Explanation: Execution of Java program starts from the main() method.

7. Which keyword is used to inherit a class in Java?

  • A) implement
  • B) inherits
  • C) extends
  • D) super
Correct Answer: C
Explanation: The extends keyword is used for inheritance in Java.

8. Which of the following is a valid Java data type?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) int
  • B) float
  • C) boolean
  • D) All of the above
Correct Answer: D
Explanation: int, float, and boolean are valid Java data types.

9. Which symbol is used to end a statement in Java?

  • A) :
  • B) .
  • C) ;
  • D) ,
Correct Answer: C
Explanation: Semicolon (;) is used to terminate statements in Java.

10. Which of the following is used to create an object in Java?

  • A) class
  • B) object
  • C) new
  • D) create
Correct Answer: C
Explanation: The new keyword is used to create objects in Java.

11. Which of the following is not an access modifier in Java?

  • A) public
  • B) private
  • C) protected
  • D) internal
Correct Answer: D
Explanation: Java does not have an internal access modifier.

12. Which keyword is used to create a subclass?

  • A) super
  • B) this
  • C) extends
  • D) implements
Correct Answer: C
Explanation: extends is used to inherit a class in Java.

13. Which keyword is used to implement an interface?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) extends
  • B) implements
  • C) interface
  • D) inherit
Correct Answer: B
Explanation: Interfaces are implemented using the implements keyword.

14. Which of the following is a non-primitive data type?

  • A) int
  • B) float
  • C) char
  • D) String
Correct Answer: D
Explanation: String is a non-primitive (reference) data type in Java.

15. Which exception is thrown when dividing a number by zero?

  • A) NullPointerException
  • B) ArithmeticException
  • C) NumberFormatException
  • D) IOException
Correct Answer: B
Explanation: Division by zero causes ArithmeticException.

16. Which block is always executed whether exception occurs or not?

  • A) try
  • B) catch
  • C) throw
  • D) finally
Correct Answer: D
Explanation: The finally block always executes.

17. Which keyword is used to stop inheritance?

  • A) static
  • B) final
  • C) abstract
  • D) private
Correct Answer: B
Explanation: A class declared as final cannot be inherited.

18. Which of the following is used to read input from keyboard?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) Scanner
  • B) System.out
  • C) PrintWriter
  • D) FileReader
Correct Answer: A
Explanation: Scanner class is commonly used for keyboard input.

19. Which package is automatically imported in every Java program?

  • A) java.util
  • B) java.io
  • C) java.lang
  • D) java.awt
Correct Answer: C
Explanation: java.lang package is imported by default.

20. Which loop is guaranteed to execute at least once?

  • A) for loop
  • B) while loop
  • C) do-while loop
  • D) foreach loop
Correct Answer: C
Explanation: do-while loop executes at least once before checking condition.

21. Which keyword is used to refer current object?

  • A) this
  • B) super
  • C) self
  • D) current
Correct Answer: A
Explanation: this refers to the current object.

22. Which of the following is not a loop in Java?

  • A) for
  • B) while
  • C) do-while
  • D) repeat
Correct Answer: D
Explanation: Java does not have a repeat loop.

23. Which keyword is used to create an abstract class?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) interface
  • B) abstract
  • C) virtual
  • D) final
Correct Answer: B
Explanation: abstract keyword is used to declare abstract class.

24. Which of the following is used to handle multiple exceptions?

  • A) try
  • B) finally
  • C) multiple catch blocks
  • D) throw
Correct Answer: C
Explanation: Multiple catch blocks handle different exceptions.

25. Which concept allows method with same name but different parameters?

  • A) Inheritance
  • B) Polymorphism
  • C) Encapsulation
  • D) Abstraction
Correct Answer: B
Explanation: Method overloading is an example of polymorphism.

26. Which keyword is used to define a constant?

  • A) static
  • B) const
  • C) final
  • D) constant
Correct Answer: C
Explanation: final is used to create constants in Java.

27. Which class is parent of all Java classes?

  • A) String
  • B) Object
  • C) Class
  • D) System
Correct Answer: B
Explanation: Object class is the superclass of all Java classes.

28. Which operator is used for comparison?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) =
  • B) ==
  • C) !=
  • D) Both B and C
Correct Answer: D
Explanation: == and != are comparison operators.

29. Which feature of Java supports code reusability?

  • A) Polymorphism
  • B) Inheritance
  • C) Encapsulation
  • D) Abstraction
Correct Answer: B
Explanation: Inheritance allows reuse of existing code.

30. Which keyword is used to create a thread?

  • A) thread
  • B) Runnable
  • C) start
  • D) new
Correct Answer: C
Explanation: The start() method is used to start a thread.

31. Which of the following is used to achieve abstraction in Java?

  • A) Class
  • B) Object
  • C) Interface
  • D) Constructor
Correct Answer: C
Explanation: Interface is mainly used to achieve abstraction in Java.

32. Which keyword is used to handle exceptions manually?

  • A) try
  • B) catch
  • C) throw
  • D) throws
Correct Answer: C
Explanation: throw keyword is used to explicitly throw an exception.

33. Which of the following is a checked exception?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) ArithmeticException
  • B) NullPointerException
  • C) IOException
  • D) ArrayIndexOutOfBoundsException
Correct Answer: C
Explanation: IOException is a checked exception.

34. Which statement is true about constructors?

  • A) They have return type
  • B) They can be inherited
  • C) Name must be same as class
  • D) They are static
Correct Answer: C
Explanation: Constructor name must be same as class name.

35. Which access modifier allows access within the same package only?

  • A) public
  • B) private
  • C) protected
  • D) default
Correct Answer: D
Explanation: Default access allows access within the same package only.

36. Which method is used to compare two strings?

  • A) ==
  • B) equals()
  • C) compare()
  • D) match()
Correct Answer: B
Explanation: equals() method compares string values.

37. Which of the following is immutable in Java?

  • A) String
  • B) StringBuilder
  • C) Array
  • D) Object
Correct Answer: A
Explanation: String objects are immutable in Java.

38. Which collection does not allow duplicate elements?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) List
  • B) Set
  • C) Map
  • D) ArrayList
Correct Answer: B
Explanation: Set does not allow duplicate elements.

39. Which class is used for dynamic arrays?

  • A) Array
  • B) Vector
  • C) ArrayList
  • D) LinkedList
Correct Answer: C
Explanation: ArrayList provides dynamic array functionality.

40. Which keyword is used to synchronize threads?

  • A) thread
  • B) volatile
  • C) synchronized
  • D) wait
Correct Answer: C
Explanation: synchronized keyword controls thread access.

41. Which method is used to stop a thread safely?

  • A) stop()
  • B) suspend()
  • C) interrupt()
  • D) end()
Correct Answer: C
Explanation: interrupt() is the safe way to signal thread termination.

42. Which package contains collection framework?

  • A) java.io
  • B) java.util
  • C) java.lang
  • D) java.net
Correct Answer: B
Explanation: Collection framework is present in java.util package.

43. Which keyword is used to call parent class constructor?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) this
  • B) super
  • C) parent
  • D) base
Correct Answer: B
Explanation: super keyword is used to call parent constructor.

44. Which of the following is not part of OOP?

  • A) Encapsulation
  • B) Inheritance
  • C) Compilation
  • D) Polymorphism
Correct Answer: C
Explanation: Compilation is not an OOP concept.

45. Which operator is used for object reference comparison?

  • A) equals()
  • B) ==
  • C) !=
  • D) compareTo()
Correct Answer: B
Explanation: == compares object references.

46. Which feature allows multiple inheritance in Java?

  • A) Class
  • B) Abstract class
  • C) Interface
  • D) Package
Correct Answer: C
Explanation: Java supports multiple inheritance through interfaces.

47. Which class is used to take input from console?

  • A) BufferedReader
  • B) Scanner
  • C) InputStream
  • D) Both A and B
Correct Answer: D
Explanation: Both BufferedReader and Scanner can take console input.

48. Which exception is thrown when array index is invalid?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) IOException
  • B) ClassNotFoundException
  • C) ArrayIndexOutOfBoundsException
  • D) NumberFormatException
Correct Answer: C
Explanation: Invalid array index causes ArrayIndexOutOfBoundsException.

49. Which Java feature makes it platform independent?

  • A) Compiler
  • B) JVM
  • C) JDK
  • D) JRE
Correct Answer: B
Explanation: JVM enables Java to run on any platform.

50. Which type of memory is allocated at runtime?

  • A) Stack
  • B) Heap
  • C) Static
  • D) Register
Correct Answer: B
Explanation: Objects are created in heap memory at runtime.

51. Which keyword is used to prevent method overriding?

  • A) static
  • B) private
  • C) final
  • D) abstract
Correct Answer: C
Explanation: A method declared as final cannot be overridden.

52. Which of the following is not a Java keyword?

  • A) static
  • B) void
  • C) then
  • D) class
Correct Answer: C
Explanation: then is not a Java keyword.

53. Which memory stores local variables?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) Heap
  • B) Stack
  • C) Static
  • D) Method area
Correct Answer: B
Explanation: Local variables are stored in stack memory.

54. Which method is used to start execution of a thread?

  • A) run()
  • B) start()
  • C) execute()
  • D) init()
Correct Answer: B
Explanation: The start() method starts a new thread.

55. Which exception occurs when a null object is accessed?

  • A) IOException
  • B) ArithmeticException
  • C) NullPointerException
  • D) ClassNotFoundException
Correct Answer: C
Explanation: Accessing a null reference throws NullPointerException.

56. Which collection allows key–value pairs?

  • A) List
  • B) Set
  • C) Map
  • D) Queue
Correct Answer: C
Explanation: Map stores data in key–value pairs.

57. Which loop is best when number of iterations is known?

  • A) while
  • B) do-while
  • C) for
  • D) infinite loop
Correct Answer: C
Explanation: for-loop is preferred when iterations are fixed.

58. Which keyword is used to define a package?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) package
  • B) import
  • C) include
  • D) namespace
Correct Answer: A
Explanation: package keyword is used to create a package.

59. Which keyword is used to access package classes?

  • A) include
  • B) extends
  • C) import
  • D) implements
Correct Answer: C
Explanation: import is used to access package classes.

60. Which type of inheritance is not supported by Java classes?

  • A) Single
  • B) Multilevel
  • C) Multiple
  • D) Hierarchical
Correct Answer: C
Explanation: Multiple inheritance is not supported using classes in Java.

61. Which method is called automatically when object is created?

  • A) main()
  • B) finalize()
  • C) constructor
  • D) init()
Correct Answer: C
Explanation: Constructor is invoked automatically during object creation.

62. Which keyword is used to inherit interfaces?

  • A) implements
  • B) extends
  • C) inherits
  • D) interface
Correct Answer: B
Explanation: One interface inherits another using extends.

63. Which of the following is mutable?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) String
  • B) StringBuilder
  • C) Integer
  • D) Character
Correct Answer: B
Explanation: StringBuilder objects are mutable.

64. Which class is used for file reading?

  • A) FileWriter
  • B) FileInputStream
  • C) FileReader
  • D) PrintWriter
Correct Answer: C
Explanation: FileReader is used to read character files.

65. Which method releases resources before object destruction?

  • A) destroy()
  • B) free()
  • C) finalize()
  • D) delete()
Correct Answer: C
Explanation: finalize() is called by garbage collector before object removal.

66. Which operator is used for logical AND?

  • A) &
  • B) &&
  • C) |
  • D) ||
Correct Answer: B
Explanation: && is the logical AND operator.

67. Which class is thread-safe?

  • A) ArrayList
  • B) HashMap
  • C) Vector
  • D) HashSet
Correct Answer: C
Explanation: Vector methods are synchronized by default.

68. Which exception is thrown when class is not found?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) IOException
  • B) ClassNotFoundException
  • C) SQLException
  • D) RuntimeException
Correct Answer: B
Explanation: ClassNotFoundException occurs when class is missing.

69. Which concept binds data and methods together?

  • A) Inheritance
  • B) Abstraction
  • C) Encapsulation
  • D) Polymorphism
Correct Answer: C
Explanation: Encapsulation binds data and methods into a single unit.

70. Which Java component runs bytecode?

  • A) JDK
  • B) JRE
  • C) JVM
  • D) Compiler
Correct Answer: C
Explanation: JVM executes Java bytecode.

71. Which keyword is used to call parent class constructor?

  • A) this
  • B) super
  • C) parent
  • D) base
Correct Answer: B
Explanation: super keyword is used to call the parent class constructor.

72. Which Java feature allows same method name with different parameters?

  • A) Overriding
  • B) Abstraction
  • C) Overloading
  • D) Encapsulation
Correct Answer: C
Explanation: Method overloading allows same method name with different parameters.

73. Which access modifier allows access within same package only?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) public
  • B) private
  • C) protected
  • D) default
Correct Answer: D
Explanation: Default access modifier restricts access within same package.

74. Which keyword is used to create an object?

  • A) class
  • B) object
  • C) new
  • D) create
Correct Answer: C
Explanation: new keyword is used to create an object in Java.

75. Which interface provides sorting capability?

  • A) Runnable
  • B) Serializable
  • C) Comparable
  • D) Cloneable
Correct Answer: C
Explanation: Comparable interface is used to sort objects.

76. Which statement is used to handle exceptions?

  • A) throw
  • B) throws
  • C) try-catch
  • D) finally
Correct Answer: C
Explanation: try-catch block is used to handle exceptions.

77. Which Java version introduced lambda expressions?

  • A) Java 5
  • B) Java 6
  • C) Java 7
  • D) Java 8
Correct Answer: D
Explanation: Lambda expressions were introduced in Java 8.

78. Which class is parent of all exceptions?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) RuntimeException
  • B) Throwable
  • C) Exception
  • D) Error
Correct Answer: B
Explanation: Throwable is the superclass of all exceptions and errors.

79. Which package contains Scanner class?

  • A) java.io
  • B) java.util
  • C) java.lang
  • D) java.sql
Correct Answer: B
Explanation: Scanner class belongs to java.util package.

80. Which keyword is used to stop inheritance?

  • A) static
  • B) private
  • C) final
  • D) abstract
Correct Answer: C
Explanation: final keyword prevents inheritance.

81. Which loop executes at least once?

  • A) for
  • B) while
  • C) do-while
  • D) infinite
Correct Answer: C
Explanation: do-while loop executes at least once.

82. Which class is immutable?

  • A) String
  • B) StringBuilder
  • C) StringBuffer
  • D) ArrayList
Correct Answer: A
Explanation: String objects are immutable in Java.

83. Which operator is used to compare two values?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) =
  • B) ==
  • C) !=
  • D) equals
Correct Answer: B
Explanation: == operator compares two values for equality.

84. Which keyword is used to define constant?

  • A) static
  • B) constant
  • C) final
  • D) const
Correct Answer: C
Explanation: final keyword is used to define constants.

85. Which class is used to write data to file?

  • A) FileReader
  • B) BufferedReader
  • C) FileWriter
  • D) Scanner
Correct Answer: C
Explanation: FileWriter is used to write data into files.

86. Which collection does not allow duplicates?

  • A) List
  • B) Set
  • C) Map
  • D) ArrayList
Correct Answer: B
Explanation: Set does not allow duplicate elements.

87. Which method is entry point of Java program?

  • A) start()
  • B) init()
  • C) run()
  • D) main()
Correct Answer: D
Explanation: main() method is the entry point of Java program.

88. Which keyword is used for interface implementation?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) extends
  • B) implements
  • C) inherit
  • D) interface
Correct Answer: B
Explanation: implements keyword is used to implement an interface.

89. Which exception is unchecked?

  • A) IOException
  • B) SQLException
  • C) ClassNotFoundException
  • D) ArithmeticException
Correct Answer: D
Explanation: ArithmeticException is an unchecked exception.

90. Which Java component is platform dependent?

  • A) Java source code
  • B) Bytecode
  • C) JVM
  • D) JDK
Correct Answer: C
Explanation: JVM is platform dependent, making Java platform independent.

91. Which keyword is used to refer current class object?

  • A) super
  • B) this
  • C) self
  • D) object
Correct Answer: B
Explanation: this keyword refers to the current class object.

92. Which Java feature supports runtime polymorphism?

  • A) Method overloading
  • B) Method overriding
  • C) Constructor overloading
  • D) Static binding
Correct Answer: B
Explanation: Method overriding enables runtime polymorphism.

93. Which keyword is used to declare an abstract class?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) virtual
  • B) abstract
  • C) final
  • D) interface
Correct Answer: B
Explanation: abstract keyword is used to declare abstract class.

94. Which stream is used for byte-oriented file output?

  • A) FileReader
  • B) FileWriter
  • C) FileOutputStream
  • D) BufferedReader
Correct Answer: C
Explanation: FileOutputStream writes byte data to files.

95. Which class provides synchronized string operations?

  • A) String
  • B) StringBuilder
  • C) StringBuffer
  • D) CharSequence
Correct Answer: C
Explanation: StringBuffer methods are synchronized and thread-safe.

96. Which collection maintains insertion order?

  • A) HashSet
  • B) TreeSet
  • C) LinkedHashSet
  • D) PriorityQueue
Correct Answer: C
Explanation: LinkedHashSet maintains insertion order.

97. Which exception occurs when array index is invalid?

  • A) NullPointerException
  • B) ArithmeticException
  • C) ArrayIndexOutOfBoundsException
  • D) ClassCastException
Correct Answer: C
Explanation: Invalid array index throws ArrayIndexOutOfBoundsException.

98. Which keyword is used to create subclass?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) implements
  • B) extends
  • C) inherits
  • D) super
Correct Answer: B
Explanation: extends keyword creates a subclass.

99. Which Java API is used for database connectivity?

  • A) JPA
  • B) JDBC
  • C) RMI
  • D) JNDI
Correct Answer: B
Explanation: JDBC is used to connect Java with databases.

100. Which access modifier has the widest scope?

  • A) private
  • B) default
  • C) protected
  • D) public
Correct Answer: D
Explanation: public members are accessible everywhere.

101. Which method is used to compare strings ignoring case?

  • A) equals()
  • B) compare()
  • C) equalsIgnoreCase()
  • D) compareTo()
Correct Answer: C
Explanation: equalsIgnoreCase() ignores case while comparison.

102. Which keyword is used to handle checked exceptions?

  • A) try
  • B) catch
  • C) throws
  • D) finally
Correct Answer: C
Explanation: throws keyword declares checked exceptions.

103. Which interface is used to create thread?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) Serializable
  • B) Runnable
  • C) Cloneable
  • D) Callable
Correct Answer: B
Explanation: Runnable interface is commonly used to create threads.

104. Which collection allows duplicate elements?

  • A) Set
  • B) Map
  • C) List
  • D) TreeSet
Correct Answer: C
Explanation: List allows duplicate elements.

105. Which method converts string to integer?

  • A) Integer.valueOf()
  • B) parseInt()
  • C) toInt()
  • D) convert()
Correct Answer: B
Explanation: parseInt() converts String to int.

106. Which class is used to format date?

  • A) Date
  • B) Calendar
  • C) DateFormat
  • D) LocalDate
Correct Answer: C
Explanation: DateFormat formats date and time.

107. Which Java feature supports code reusability?

  • A) Encapsulation
  • B) Inheritance
  • C) Abstraction
  • D) Polymorphism
Correct Answer: B
Explanation: Inheritance enables code reusability.

108. Which operator is used for object reference comparison?

Download Now - 2000 Most Repeated Questions Answer PDF
  • A) equals()
  • B) ==
  • C) !=
  • D) instanceof
Correct Answer: B
Explanation: == compares object references.

109. Which package is imported by default?

  • A) java.util
  • B) java.io
  • C) java.lang
  • D) java.net
Correct Answer: C
Explanation: java.lang package is imported by default.

110. Which keyword is used to check object type?

  • A) typeof
  • B) instance
  • C) instanceof
  • D) istype
Correct Answer: C
Explanation: instanceof checks object type at runtime.

We hope these Java MCQ Questions and Answers help you revise important concepts and improve your confidence for exams and interviews. Regular practice of MCQs is one of the best ways to master Java fundamentals.

For more programming MCQs, interview questions, and exam-oriented study material, keep visiting our website and share this post with your friends and classmates.

Sharing Is Caring:

Monika Rathod is an educator who writes exam-oriented content for Political Science, History, and Science. She explains concepts in a simple and clear way to help students prepare effectively for competitive exams.

Leave a Comment