Using a non-static variable in a static method JAVA

前端 未结 4 2104
臣服心动
臣服心动 2021-01-17 06:12

So I am writing a very large java code, within this code I want it to output files in a particular file format. In this instance it is going to be a simple .txt file.

4条回答
  •  轮回少年
    2021-01-17 06:50

    Non static means that it belongs to some class instance(object). So pass this object to your static method and/or create those objects inside it.

提交回复
热议问题