1. What are the different types of variables in Java?
2. What is a local variable in Java?
3. What is an instance variable in Java?
4. What is a static variable in Java?
5. How is a constant defined in Java, and what’s its purpose?
6. What is the difference between final
, finally
, and finalize
in Java?
7. Can a local variable be declared as static
in Java?
8. How are instance variables accessed within a class?
9. What is the scope of a local variable in Java?
10. How is shadowing of variables in Java resolved?
11. What is the purpose of the static
keyword in Java?
12. How can you access a static variable in Java?
13. What is the difference between class variables and instance variables in Java?
14. How do you initialize instance variables in Java?
15. What is the difference between local variables and instance variables in terms of default values?
16. Can you access instance variables without creating an object of the class?
17. What is the difference between a variable and a constant in Java?
18. Can you declare an array as final
in Java?
19. What is the purpose of the volatile
keyword in Java?
20. What is the difference between instance variables and class variables in Java?