Originally posted by Campbell Ritchie:
Classes can actually be private, but I have only seen that inside other classes. If a class isn't inside another class, private access would mean it would be inaccessible to any code from anywhere.
Originally posted by Phillipe Rodrigues:
Request more explanation on the "Private" accessibility modifier with reference to below example:Why I should get the below error?
Output:
---------- Compile ----------
Sub_class.java:1: modifier private not allowed here
private class Sub_class extends Super_class
1 error
Output completed (1 sec consumed) - Normal Termination