java错误Cannot make a static reference to the non-static method

转: 我在一个类中写了一个public void getDate()方法和一个main方法,在main方法中直接调用getDate()方法,于是就出现了这个错误提示。后来实例化类,再用实例化的类调用getDate()方法就没问题了。 在静态方法中,不能直接访问非静态成员(包括方法和变量 ...

Sun Apr 22 23:41:00 CST 2012 1 5663
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM