Top 50 Java MCQ Questions – Master Java for Interviews & Exams
Multiple-choice questions are a quick way to test and reinforce Java fundamentals. Here's a sample set covering core concepts.
1. Which of these is not a Java primitive type?
a) int b) float c) String d) boolean
Answer: c) String — it's a class, not a primitive type.
2. What is the default value of a boolean variable in Java?
a) true b) false c) 0 d) null
Answer: b) false
3. Which keyword is used to inherit a class in Java?
a) implements b) extends c) inherits d) super
Answer: b) extends
4. Which collection class allows duplicate elements but maintains insertion order?
a) HashSet b) TreeSet c) ArrayList d) HashMap
Answer: c) ArrayList
5. Which method is the entry point of a Java application?
a) start() b) run() c) main() d) init()
Answer: c) main()
6. Which of these is used to handle exceptions in Java?
a) try-catch b) if-else c) for-loop d) switch
Answer: a) try-catch
7. What is the size of an int in Java?
a) 8 bits b) 16 bits c) 32 bits d) 64 bits
Answer: c) 32 bits
8. Which keyword prevents a class from being subclassed?
a) static b) final c) private d) abstract
Answer: b) final
9. Which interface must a class implement to be used with the "for-each" loop?
a) Comparable b) Iterable c) Runnable d) Serializable
Answer: b) Iterable
10. Which of these is used to create a thread pool?
a) new Thread() b) ExecutorService c) Runnable d) ThreadGroup
Answer: b) ExecutorService
Master Java with Uncodemy
Hands-on training, live projects, and placement support in our Java Programming Course.