Поэтому я свел проблему к этому.
Код: Выделить всё
class Hello{
class A
{
public A()
{
System.out.println("in A");
}
}
public static void main(String args[])
{
A a = new A();
}
}
Код: Выделить всё
error: non-static variable this cannot be referenced from a static context
A a = new A();
Что я делаю не так?
Если вы не можете создать объект в своей основной функции, как вы что-нибудь сделаете?
Подробнее здесь: https://stackoverflow.com/questions/797 ... ew-objects
Мобильная версия