Class in Java can not be private or protected

In Java you can not use private or protected access modifiers with class. You can only use public or just leave it as default.

Reason is
1. If we make a class private in java then no other class can reuse that class. Hence it will violate values of OOPS which are soul of Java.

2. If you make a class protected, by this you will allow your class to be visible outside your package also. Then anyone can extend that protected class and override its public method. And you will not like it. You have made somethings to be public just for you application use means inside your package only.

So don't ever make a class private or protected because Java compiler will not let you do this.