标签:style blog ar color sp java div log bs
public class TestBase { int x = 3; public void ppp() { System.out.println(x + 4); }
} public class TestMain { public static void main(String[] args) { TestBase t = new TestBase() { public void ppp(){ System.out.println(x + 5); } }; t.ppp(); } }
相当于新建一个继承自TestBase的匿名类(如果没理解错的话) 输出的是8
标签:style blog ar color sp java div log bs
原文地址:http://www.cnblogs.com/briller/p/4155976.html