Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在使项目开始时不是静态的主类静态时遇到问题。但是,当我按照说明使类成为静态并运行它时,它会给出错误
这没有错误:
static class MyStaticClass {}
你可以再详细一点吗?
如果“主”类是指定义主方法的类,那么请确保该类的所有成员也是static.
static
在这一点上这有点投机,但如果你让你的类静态你将不得不使
一般来说,你不能做任何依赖于被实例化的类的事情。