Question

What is the purpose of the 'static' keyword in Java?

A To make a variable's value constant and unmodifiable
B To indicate that a member belongs to the class itself rather than to instances of the class
C To prevent a class from being subclassed
D To declare a variable that retains its value between method calls only
E To restrict access to a method from outside the package
Practice Next

Relevant for Exams:

Hey! Ask a query