Possible duplicate:protected / public inner classes
I'm sure the question has already been asked, but I could not find it, so I will ask ...
I am curious what is the difference between a private (protected) and a public inner class. I can use both of the class containing the class using an external class object.
public class A{ private class B{ } public static void main(String[] args){ A a = new A(); B b = a.new B(); } }
Access to a private inner class can be obtained within the class that defined it.
If you have another class, Bnot displayed:
B
public class C { public static void main(String[] args){ A a = new A(); B b = new B(); // compile error } }
Actually, you are still inside class A, since the main method is the static method of class A
Source: https://habr.com/ru/post/1664051/More articles:"Missing" secret_key_base "for" production "environment" error on Heroku - ruby-on-railsMonth subtracts month - pythonApache ZooKeeper Web Interface - hadoopPrivate class extension in Java - javaR-version of scattering 3 (matlab) - rWhy the / admin application in debug mode false gives me a 500 server error - python-2.7Register two custom cells with RxSwift - iosAngular pass data from child to parent - outputNumerous NativeBase icons in InputGroup - reactjsfirefox TypeError: wrappedCompareFn is not a function - firefoxAll Articles