Java MCQ Questions

Welcome to the Java MCQ Questions Quiz. This quiz contains 10 important Java programming questions commonly asked in interviews, academic exams, and competitive programming tests. The quiz covers Java basics, OOP concepts, data types, operators, and important language features.

Practice these MCQs to strengthen your Java fundamentals and improve your programming knowledge.

Q1. Who developed Java?
A) Bill Gates
B) James Gosling
C) Dennis Ritchie
D) Bjarne Stroustrup
Explanation:
Java was developed by James Gosling at Sun Microsystems in 1995.
Q2. Which keyword is used to define a class in Java?
A) function
B) class
C) define
D) object
Explanation:
The keyword class is used to declare a class in Java.
Q3. Which of the following is not a Java primitive data type?
A) int
B) boolean
C) String
D) double
Explanation:
String is a class in Java, not a primitive data type.
Q4. Which method is the entry point of a Java program?
A) start()
B) main()
C) run()
D) execute()
Explanation:
The JVM starts execution from the main() method.
Q5. Which of the following is used to achieve inheritance in Java?
A) extends
B) implements
C) inherit
D) super
Explanation:
The keyword extends is used to inherit a class in Java.
Q6. Which operator is used for comparison in Java?
A) ==
B) =
C) :=
D) ===
Explanation:
The == operator compares two values for equality.
Q7. Which concept allows the same method name with different parameters?
A) Method Overloading
B) Method Overriding
C) Encapsulation
D) Abstraction
Explanation:
Method overloading allows multiple methods with the same name but different parameter lists.
Q8. Which package is imported automatically in every Java program?
A) java.util
B) java.io
C) java.lang
D) java.net
Explanation:
The java.lang package is automatically imported by the Java compiler.
Q9. Which keyword is used to create an object in Java?
A) new
B) create
C) object
D) alloc
Explanation:
The new keyword allocates memory and creates an object.
Q10. Which of the following is a feature of Java?
A) Platform Dependent
B) Object-Oriented
C) Machine Specific
D) Assembly Based
Explanation:
Java is an Object-Oriented Programming (OOP) language and follows the principle of “Write Once, Run Anywhere”.

Leave a Reply

Your email address will not be published. Required fields are marked *