Possible Duplicate:
What is the reason behind “non-static method cannot be referenced from a static context”?
Cannot make a static reference to the non-static method
cannot make a static reference to the non-static field无法从我无法理解什么是错我的代码类型二
使静态参考非静态方法FXN(INT)。
class Two {
public static void main(String[] args) {
int x = 0;
System.out.println("x = " + x);
x = fxn(x);
System.out.println("x = " + x);
}
int fxn(int y) {
y = 5;
return y;
}
}
异常在线程“主要” java.lang.Error的:未解决的问题,编译: 无法从类型使静态参考非静态方法FXN(INT)两个
不是你的低调选民,但你会想通过[Java教程](http://docs.oracle.com/javase/tutorial/reallybigindex。HTML)或一本基础教科书来学习Java的基础知识。 – 2012-07-15 12:12:20
如果您不了解我现在处于的状况,请不要投下这个问题。 :/ 我仍然在Head First Java的第4章,并且对关于回报的陈述感到困惑。我只是想做到这一点。 – kunal 2012-07-15 12:36:44
在问这个问题之前,你应该先搜索一下答案。 – 2012-07-15 13:03:41