You need an entry point into your program. Static means that you can call the function without having to instantiate an object/instance of a class. It's a bit "chicken and egg"... you can't instantiate an object before you're inside the program.
A static method can be called without instantiating an object. Therefore main()
needs to be static in order to allow it to be the entry to your program.
As David says, you can just add the keyword static
to the function definition to change it. It's worth looking into static (class) methods vs instance methods, and knowing the difference can be useful at times.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…