Os:windows7 x64
Jdk:jdk-8u131-windows-x64
Ide:eclipse Oxygen Release (4.7.0)
Code:
The inner class is within a class that defines a class//outer class Testouter {private int num = 10;//Inner class private class Testinner {public void Showinner () {///within The class can access the private member SYSTEM.OUT.PRINTLN (NUM) of the external classes;}} public void Show () {Testinner ti = new Testinner (); Ti.showinner ();}} Class Demo {public static void main (string[] args) {new Testouter (). Show ();//Note: The general inner class is only allowed internal access, the modifier is private}}
Results:
Java is good, worth learning.
Learning resources: CZBK's video library. If you have public resources, can share to me, with your resources to learn also can.
Blog post is to watch the video, into thinking written. It's good that the teacher speaks well. Blog bad, is to give the most bitter not serious.
If you think the blog can be improved, leave a message.
JavaSE8 base inner classes can access private members of external classes