Home  >  Article  >  Java  >  What does public static void main mean?

What does public static void main mean?

coldplay.xixi
coldplay.xixiOriginal
2020-06-20 16:25:0924632browse

What does public static void main mean?

#What does public static void main mean?

public static void main means:

public static void main(String[] args), which is the entry address of the java program, java virtual machine When running a program, the first thing you look for is the main method.

1. Here we need to explain the main function. The parameter String[] args is a string array that receives parameters passed in when the program is executed. If you are on the console, you can pass the parameters in through compilation and execution. The command line is as follows:

What does public static void main mean?

2. What is passed into the main function is a string array, args[ 0] =a; args[1]=b;args[2]=c, If no parameters are passed in, args will be empty.

What does public static void main mean?

#3. Enter the parameters to be passed in Programmer arguments, separated by spaces a b c.

What does public static void main mean?

4. Before the vm attempts to run a class, it first checks whether the class contains a special method. This method must be public so that it can be accessed from anywhere.

What does public static void main mean?

#5. "Public" indicates the access rights of the program, which means it can be referenced on any occasion.

What does public static void main mean?

6. "static" means that the method is static and does not depend on the object of the class.

What does public static void main mean?

7. The "void:main()" method does not need to return a value.

What does public static void main mean?

Recommended tutorial: "java video tutorial"

The above is the detailed content of What does public static void main mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn