Declaration And Access Control - Study Mode

[#31] What keyword is used to declare a variable that can be accessed without creating an instance of the class?
Correct Answer

(A) static

[#32] Which access modifier restricts a class member's visibility to only the same class, its package, and subclasses?
Correct Answer

(D) protected

[#33] In Java, what is the purpose of the final keyword when applied to a class?
Correct Answer

(B) It prevents subclassing.

[#34] Which keyword is used to declare a method that cannot be overridden in a subclass?
Correct Answer

(A) final

[#35] What is the access level of a class member declared as protected in Java?
Correct Answer

(B) protected