Non-static method 'xxx cannot be referenced from a static context原因之一

在这里插入图片描述
没有在int前加static报错。
在这里插入图片描述
错误原因:
mian()方法时静态方法,而自己定义的那个方法如果不加static是成员方法,成员方法无法在静态方法中调用。

猜你喜欢

转载自blog.csdn.net/qq_38534524/article/details/89963986