java Quiz

1. Which of the following is true about the final keyword in Java?

2. What is the purpose of the try-catch block in Java?

3. Which of the following is a correct way to create an object of a class named MyClass?

4. What is the output of the following code snippet?

int x = 5;
        System.out.println(x++);

5. Which of the following is true about Java interfaces?

6. What is the purpose of the super keyword in Java?

7. Which of the following is a primitive data type in Java?

8. What is the purpose of the static keyword in Java?

9. Which of the following is a correct way to compare two strings in Java?

10. What is the purpose of the garbage collector in Java?

11. Which collection class does not allow duplicate elements and maintains elements in a sorted order?

12. What is method overloading in Java?

13. Which of the following is true about abstract classes in Java?

14. What is the purpose of the instanceof operator in Java?

15. Which of the following is true about Java's String class?

16. What is the purpose of the package keyword in Java?

17. What is the purpose of the finally block in a try-catch statement?

18. Which of the following is a checked exception in Java?

19. What is the purpose of the Runnable interface in Java?

20. What does the keyword transient signify when used in a class?