【发布时间】:2013-11-10 23:36:59
【问题描述】:
这个错误困扰着我:
cannot make a static reference to the non-static method XYZ from the type ABC
我的眼睛只是呆滞。我意识到以前有人问过这个问题,但我想要 5 岁的治疗。只是没有意义..
我正在运行一个类,我在 public static void main 中有代码,然后我在它之外创建了一个函数。
【问题讨论】:
-
一个 5 岁的孩子会理解你
cannot make a static reference to the non-static method XYZ from the type ABC并相应地更改他们的代码。查看实例是什么。 -
@SotiriosDelimanolis - 好的,谢谢
-
如果您解释一下现有解释的哪些部分不清楚,这将有所帮助
-
@RichardTingle - 是的,我知道。好的,谢谢
-
您的代码至少需要一个
new才能工作。
标签: java static-methods