Some small points of knowledge summarized by myself.

1. Because our static properties and methods must be initialized before the construction method, we cannot define static properties and methods in the construction method.
2. Because the main function is static, we need to write a new method in the main function first.
3. Why must the main function be static? Because the main function exists when it is loaded, the system directly finds the static method.
Static, the
main function that is loaded into the memory is actually a method of its class. For example, if a class is test, then the main of the class is actually test.main(String[] args). It is well known that if a method is not static, The class must be instantiated first, for example, test t=new test(); and then test.main();
and this is unrealistic for the main function of running a program, so for example, define the main function It is static, so that test.main() can be called directly.
Because main is the main function of this class, the entry, if you go to the instance every time you enter this entry and then call the entry method, it will be very wordy.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324643971&siteId=291194637