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?
Explanation:
Java was developed by James Gosling at Sun Microsystems in 1995.
Java was developed by James Gosling at Sun Microsystems in 1995.
Q2. Which keyword is used to define a class in Java?
Explanation:
The keyword class is used to declare a class in Java.
The keyword class is used to declare a class in Java.
Q3. Which of the following is not a Java primitive data type?
Explanation:
String is a class in Java, not a primitive data type.
String is a class in Java, not a primitive data type.
Q4. Which method is the entry point of a Java program?
Explanation:
The JVM starts execution from the main() method.
The JVM starts execution from the main() method.
Q5. Which of the following is used to achieve inheritance in Java?
Explanation:
The keyword extends is used to inherit a class in Java.
The keyword extends is used to inherit a class in Java.
Q6. Which operator is used for comparison in Java?
Explanation:
The == operator compares two values for equality.
The == operator compares two values for equality.
Q7. Which concept allows the same method name with different parameters?
Explanation:
Method overloading allows multiple methods with the same name but different parameter lists.
Method overloading allows multiple methods with the same name but different parameter lists.
Q8. Which package is imported automatically in every Java program?
Explanation:
The java.lang package is automatically imported by the Java compiler.
The java.lang package is automatically imported by the Java compiler.
Q9. Which keyword is used to create an object in Java?
Explanation:
The new keyword allocates memory and creates an object.
The new keyword allocates memory and creates an object.
Q10. Which of the following is a feature of Java?
Explanation:
Java is an Object-Oriented Programming (OOP) language and follows the principle of “Write Once, Run Anywhere”.
Java is an Object-Oriented Programming (OOP) language and follows the principle of “Write Once, Run Anywhere”.
