Main function
- Role:
the starting point of running, the main function enables the class to run independently - Features:
-
There is no main function, it can be compiled, but it cannot be run
-
A class with a main function is called a driver class
-
The format must be:
public static void main(String[] args){ }
- public: because it must be called by an external function
- static: the implementation can be called without creating an object
- void: did not receive the value of the return parameter
- String[] String array type parameter (JVM passes a string type array to the main function, but the array length is 0)
String is the most common data type, it can be converted into other types of data
-
references
https://www.cnblogs.com/huanmin/p/6429778.html Why is the main function format public static void main(String[] args){}