Static Overview QuizJ8 Home « Static Overview Quiz

Java Objects & Classes Quiz 12

The quiz below tests your knowledge of the material learnt in Objects & Classes - Lesson 12 - Static Overview.

Question 1 : What do static variables apply to?
- Static variables apply to a class
Question 2 : We prefix static variables with the name of the method?
- We prefix static variables with the name of the class.
Question 3 : How many copies of a static variable can we have?
- There is only one copy of each static variable in a class which is shared by all instances of that class.
Question 4 : Static variables must be assigned a value before use?
- Static variables do NOT have to be assigned a value before use because like instance variables they are assigned a default value according to their type.
Question 5 : Static variables are initialized as soon as a class is loaded and before any instances of the class are instantiated?
- Static variables ARE initialized as soon as a class is loaded and before any instances of the class are instantiated.
Question 6 : What is the lifetime of a static variable?
- A static variable exists for as long as the class it belongs to is loaded in the <code>JVM</code>.
Question 7 : Static variables are independent of any instance and so they can be used by all instances of the class?
- Static variables ARE independent of any instance and so they CAN be used by all instances of the class.
Quiz Progress Bar Please select an answer


What's Next?

The next quiz on Java Objects & Classes is all about enumerations.