There are four accessor modifier named- public, protected, defualt(unnamed) and private. I am a bit confused about the difference between default and protected accessor modifier. Will someone elaborate?
A method without accessor modifier (default) can be visible for all other classes in same package. A protected method can be visible for all other classes in same package, and all sub-classes even if the sub-classes are in another package.