Can you declare a class as private in Java?

Since there’s no such concept as ‘subpackage’ or ‘package-inheritance’ in Java, declaring class protected or package-private would be the same thing. You can declare nested and inner classes as protected or private, though.
For More Information Please Refer:

You May Also Like to Read: