| package com.itheima; 
 import com.itheima.A.B;
 
 public class Test5 {
 /**第五题
 *  在打印语句中如何打印这3个x变量?
 
 class A {
 int x = 1;
 
 class B {
 int x = 2;
 
 void func() {
 int x = 3;
 System.out.println( ? );
 }
 }
 }
 * @param args
 */
 public static void main(String[] args) {
 new B().func();
 }
 }
 
 
 class A {
 int x = 1;
 static class B {
 int x = 2;
 void func() {
 int x = 3;
 System.out.print("A.X = " + new A().x + ";  B.X = " + new B().x + ";  X
 
 = " + x);
 }
 }
 }
 |