+ 3
[java] Why can't I make my abstract class package-private or protected?
My package structure looks like this: myFolder |_mySubFolder | |_mySubClass.java |_myAbstractClass.java Since the "mySubClass" is in the same folder as "myAbstractClass", I thought that "mySubClass" can have access to it if "myAbstractClass" has the visibility modifiers "package-private" or "protected"? But for some reasons it doesn't have.
1 Réponse
0
Actually, they don't belong to the same package.
Whereas we recognize hieralchical package structures,
Java compiler does not.
"myFolder" and "myFolder.mySubFolder" just have different names
so they should be treated as independent packages without any inclusive relationships.