1. What is a method in Java?
2. How are methods declared in Java?
3. What is the purpose of the return
statement in a method?
4. What is method overloading in Java?
5. What is method overriding in Java?
6. What is a constructor in Java, and how does it differ from a method?
7. Can a constructor have parameters in Java?
8. What is a static method in Java, and how does it differ from an instance method?
9. What is the void
return type in Java methods?
10. Can a method have multiple return
statements?
11. What is method chaining in Java?
12. What is the difference between a parameter and an argument in a method?
13. What is the purpose of the this
keyword in a method?
14. What is a method signature in Java?
15. What is method visibility in Java, and how is it specified?
16. What is the @Override
annotation used for in Java methods?
17. Can a subclass override a final
method in its superclass?
18. What is the purpose of the super
keyword in Java methods?
19. What are method parameters and why are they used?
20. What is the difference between a method declaration and a method call?
21. What is a recursive method, and how does it work?
22. What is method visibility, and how do access modifiers affect it?
23. What is method overriding, and when is it used?
24. What is the difference between public
, private
, protected
, and package-private methods in terms of visibility?
25. Can a method be both static
and final
in Java?
26. How do you prevent a method from being overridden in a subclass?
27. What is the purpose of method parameters, and how are they declared?
28. What is method overloading, and when is it useful?
29. What is method hiding in Java?
30. What is the purpose of the default
keyword in Java methods (Java 8 and later)?