Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What is a class variable?
Think about shared data among objects.
When is a class variable created?
Consider the class lifecycle.
What happens to class variables when a class is loaded?
Think about the class loading process.
Class variables can be accessed only through instances of the class.
Remember how static access works.
Create a Java class with a static variable and multiple objects modifying it. Show the output of the modifications.
Think about how a static field is modified across different instances.
Discuss the impact of static variables in a multi-threaded environment. How would you ensure thread safety?
Consider how threads may access shared data and where issues might arise.
6 more questions in this section. Enroll free to practise them all.
Enroll free