Home > Back-end >  Why can't in Java protected decorator?
Why can't in Java protected decorator?

Time:12-07

Why can only use public and modified by default? From the point of the visibility, public> Protected> The default, why can't in the middle of the protected? Protected is more than friendly out a subclass can be seen, but the public is also a subclass visible, so why not only protected?

CodePudding user response:

Public class Test {
Protected class Test2 {
//the inner class can be
}
}

CodePudding user response:

This is for members of the modification, control the inheritance relationship between father and son visibility

CodePudding user response:

I don't know the building Lord,

CodePudding user response:

refer to the second floor xcf007 response:
this is for members of the modification, control the inheritance relationship between father and son of visibility
meitaidong
  • Related