Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Java by (10.2k points)

I have seen some references refer to a access modifier in Java called private protected (both words together):

private protected someMethod() {

}

One of the pages I found referring to this is here. My school lesson also referred to this access modifier (and said it exists). Using it, however, results in an error in the Java language.

I tried with both variables and methods and I'm pretty sure it doesn't exist, but I want an explanation of what happened. Was it considered, then rejected? Or did it get removed in a newer version of Java?

Edit: I am not looking for info about the protected keyword.

1 Answer

0 votes
by (46k points)

There are confusing/unclear stories:

One, from the Princeton source you put, and also from MIT archives, states that:

Note: The 1.0 release of the Java language supported five access levels: the four listed above plus private protected. The private protected access level is not supported in versions of Java higher than 1.0; you should no longer be using it in your Java programs.

But this feature is not specified on any official documentation for Java 1.0 here or here.

My guess is that this feature didn't make it to the official 1.0 version, since the official language specification is from August 1996 and Princeton source was last modified on February 1996.

PS: shame on Oracle for removing the archives for older versions.

Browse Categories

...