导航

2014年2月10日

摘要: 1.静态方法中不能调用非静态的成员或成员方法: 不能引用非静态成员变量大家都很清楚:[java]view plaincopypublicclassAinta;publicstaticvoidmain(String[]args){a=2;//错误!!a非静态}但是大家往往忽略以下的情况:[java]view plaincopypackagecn.edu.chd.test;publicclassB{publicstaticvoidmain(String[]args){newC();//错误,该类是动态类newB().newC();//正确newD();//正确,该类是静态类}publicvoid. 阅读全文

posted @ 2014-02-10 20:20 ghostll 阅读(327) 评论(0) 推荐(0) 编辑

我的专栏