Easy learning with example program codes

can we declare a class as private in java?

Yes, we can declare a class as private but these classes can be only inner or nested classes. We can’t a top-level class as private because it would be completely useless as nothing would have access to it.

Java interview questions on access modifiers

Please follow and like us:

Copyright © 2020 CodesJava Protection Status