Declaration And Access Control - Study Mode

[#16] Name the keyword that makes a variable belong to a class, rather than being defined for each instance of the class.
Correct Answer

(A) static

[#17] What keyword is used to declare a method that can be called without creating an instance of the class?
Correct Answer

(A) static

[#18] Which of the following access modifiers restricts a method or variable's access to the same package only?
Correct Answer

(D) package-private

[#19] In Java, what is the purpose of the static keyword when applied to a variable?
Correct Answer

(C) It allows access from any class.

[#20] Which keyword is used to define a superclass's method that is overridden by a subclass method?
Correct Answer

(C) super