non-static variable object1 cannot be referenced from a static context

前端 未结 2 1289
夕颜
夕颜 2021-01-29 09:43

I\'m having a little trouble getting my application to work.

I get the error: error: non-static variable object1 cannot be referenced from a static context

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-29 10:08

    public object object1 make this as public static object object1;

    You can not refer non-static class variables inside static method.

提交回复
热议问题