⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 outer5.java

📁 JAVA编程思想源代码 值得一下 很难找的
💻 JAVA
字号:
package chapter6;

public class Outer5 {

	public static void main(String[] args) {
		OuterX outer = new OuterX();
		outer.print();

	}
}

class OuterX {
	private int index = 100;

	class Inner {
		private int index = 50;

		void print() {
			int index = 30;
			System.out.println("in the method index = " + index); // 30
			System.out.println("in the inner class index = " + this.index); // 50
			System.out.println("in the outer class index = "
					+ OuterX.this.index); // 100
		}
	}

	void print() {
		Inner inner = new Inner();// 得到内部类的引用
		inner.print();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -