amitshekhariitbhu / android-interview-questions

Your Cheat Sheet For Android Interview - Android Interview Questions and Answers
https://outcomeschool.com
Apache License 2.0
11.48k stars 2.27k forks source link

Wrong order of the access modifiers #66

Closed rishabhcha closed 4 years ago

rishabhcha commented 6 years ago

To my knowledge answer to this question: "What are the access modifiers you know? What does each one do?" is wrong.

default is more restrictive than protected because default's scope is within the same class and package whereas the scope of protected is the same class, same package, and other packages as well through inheritance.

So the order of the access modifiers from the least restrictive to the most restrictive should be: public > protected > default > private