Java Fundamentals Quiz
Test your knowledge by answering the 30 questions below.
1. What is Java?
2. Which command is used to compile a Java file?
3. Which of the following is NOT a primitive type in Java?
4. What is the size of an 'int' in Java?
5. What does JVM stand for?
6. Which of these keywords is used to define a constant in Java?
7. What is the extension of a Java source file?
8. What is the extension of a compiled Java file (bytecode)?
9. Which operator is used to allocate memory for an object?
10. How do you write a single-line comment in Java?
11. Which method is the entry point of a Java program?
12. What does the 'break' statement do in a loop?
13. What does the 'continue' statement do in a loop?
14. In Java, array indices start at:
15. What is the result of 10 % 3 in Java?
16. Which conditional structure is appropriate for testing multiple values of the same variable?
17. Which package is imported by default in all Java programs?
18. Which of the following is used to handle exceptions in Java?
19. Which keyword is used to explicitly throw an exception?
20. Which of these loops always executes at least once?
21. What is the name of the Java tool that automatically manages memory deallocation?
22. Which class is used to read user input from the keyboard?
23. If a local variable hasn't been initialized in Java, what happens?
24. What is the logical 'AND' operator in Java?
25. Which method of the String class returns the length of the string?
26. What does 'API' mean in Java?
27. Which keyword is used to declare a method that does not return any value?
28. What is the return type of the System.out.println() method?
29. Which of these types allows storing decimal numbers (floating point) with the highest precision?
30. Which character is used to terminate a statement in Java?
Master Java Fundamentals with Interactive Practice
Java remains one of the most valuable programming languages for software development thanks to its reliability, portability, and strong ecosystem. Whether you want to build enterprise applications, REST APIs, Android apps, or cloud services, understanding the language fundamentals is the first step toward becoming a confident Java developer.
This Java Fundamentals Quiz is designed to evaluate your understanding of the essential concepts that every programmer should know. Questions cover variables, primitive data types, operators, conditional statements, loops, methods, arrays, strings, object-oriented programming basics, exception handling, and common Java syntax.
Unlike memorizing theory, solving practice questions helps reinforce concepts through active learning. Each quiz provides immediate feedback so you can identify weak areas and improve your problem-solving skills before exams, certifications, or technical interviews.
Whether you're a university student, coding bootcamp learner, self-taught programmer, or experienced developer reviewing the basics, regular practice is one of the fastest ways to strengthen your Java knowledge and write cleaner, more reliable code.