how to access a non static member from a static method in java?

前端 未结 5 1715
刺人心
刺人心 2020-12-22 12:35

I have a situation where i have to access a non static member from inside a static method. I can access it with new instance, but current state will be lost as non static me

5条回答
  •  太阳男子
    2020-12-22 13:07

    What you are asking for doesn't really make sense. Just make your method non-static because your static method cannot be tied to an instance.

提交回复
热议问题