Declaration And Access Control - Study Mode

[#6] In Java, which access modifier allows a method or variable to be accessed within the same package only?
Correct Answer

(D) package-private

[#7] Which keyword is used to explicitly specify that a method cannot be overridden in a subclass?
Correct Answer

(B) final

[#8] What is the default access modifier for a class in Java if no access modifier is specified?
Correct Answer

(D) package-private

[#9] Which access modifier allows a class member to be accessed only within its own class and package?
Correct Answer

(D) package-private

[#10] In Java, which access modifier allows a class member to be accessed from anywhere in the code?
Correct Answer

(A) public