当我尝试添加Edge类(子类?)的新实例时,我收到"non-static variable this non be referencedfrom a staticcontext“错误。添加到我的数组列表中。我不知道我做错了什么!public class stuff{
ArrayList<Edge> ed
因此,我正在调用同一个类的主方法中定义的方法。我使用'this‘关键字引用可调用方法。为什么我不能在静态主方法中调用这个非静态方法,如下面所示?
通过对设计的选择,构建一个单独的实现逻辑类是否有意义?从本质上说,main类应该只有一个简单的方法。任何想法都将不胜感激。UniqueChars.java:8: non-static variable this cannot be referencedf
我发现了一个错误non-static method getForm2() cannot be referencedfrom a staticcontext。现在的问题是,backCommand在form2中不能切换回First.java中的form1,它会弹出错误non-static variable this cannot be referencedfroma st
在编写使用书、带和光盘类来创建对象的BookStoreApplication时。尽管没有完成,但应用程序类应该创建新的BookStoreItems,即图书、磁带和CD。它们继承自BookStoreItems类。在这个应用程序类中,我一直收到以下错误:
error: non-static method printMenu() cannot be referencedfrom a <
文件是"handicap.java",因此主类是"handicap“。如果我尝试将Score类或Course类嵌套在"handicap“类中,则在尝试实例化这两个类的实例时收到以下错误:
handicap.java:129: non-static variable thiscannot be referencedfrom a static
我对JAXB为XML模式生成绑定类的方式有问题(为了精确起见,我不能修改这些类)。我希望将xsd:date类型映射到Joda-time LocalDate对象,并在读取、和时创建了以下DateAdapter类:
public class DateAdapter extends XmlAdaptermethod unmarshal(java.lang.String) cannot be referencedfrom a staticconte
我创建了一个包含一些函数的Sphere类。然后,我创建了一个充当“驱动程序类”的MultiSphere类。我将Sphere类放在driver类中(这就是您应该如何使用类/driver类吗?)现在,我似乎收到了一个关于尝试访问Sphere.diameter变量的错误,因为它首先通过Multisphere类。我的IDE说 Multisphere.this cannot be refer