日期:2014-05-20 浏览次数:20728 次
class A{ public void getA(){} class B{ public void getA(){ //这里如何调用主类的getA()? } } }
/** * Created by IntelliJ IDEA. * User: gaoyong * Date: 2011-10-11 * Time: 18:23:13 * To change this template use File | Settings | File Templates. */ public class A{ public void getA(){ System.out.println("主类getA()方法"); } class B{ public void getA(){ System.out.println("内部类调用getA()方法"); A.this.getA(); } } public static void main(String[] args) { A a=new A(); a.new B().getA(); } }