sgokhales sgokhales - 1 year ago 97
Java Question

Access Specifier for Interface Declaration

Why protected/private access specifier cannot be used Interfaces declaration ?

Answer Source

You can declare a protected class or indeed a private one - but only within another one. At that point it's either visible to classes derived from the outer one (in the case of protected) or not (in the case of private):

public class Outer
{
    private static class NotVisibleToSubclassesOfOuter {}

    protected static class VisibleToSubclassesOfOuter {}
}