Difference between the default access specifier and protected access specifier in java

Abhilash PS picture Abhilash PS · Mar 26, 2012 · Viewed 79.5k times · Source

I was trying to learn java and when I went through access specifiers I had a doubt. What is the difference between the default one if none is specified and the protected access specifier in java?

Answer

Coding Master picture Coding Master · May 2, 2012

This Java tutorial may be of some use to you.

Modifier    | Class | Package | Subclass | World

public      |  Y    |    Y    |    Y     |   Y

protected   |  Y    |    Y    |    Y     |   N

no modifier |  Y    |    Y    |    N     |   N

private     |  Y    |    N    |    N     |   N