#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:
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.
#3. Enter the parameters to be passed in Programmer arguments, separated by spaces a b c.
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.
#5. "Public" indicates the access rights of the program, which means it can be referenced on any occasion.
6. "static" means that the method is static and does not depend on the object of the class.
7. The "void:main()" method does not need to return a value.
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!

电脑main在计算机软件中代表主菜单或者主类。一些桌面软件,都会有一个主菜单,包含基本的操作菜单,命名为main;而在开发语言java、c语言等高级语言中,都会存在一个main的主类,是程序执行的入口。一个程序可以有多个函数,但只能有一个main()函数。

每年Apple发布新的iOS和macOS大版本之前,用户都可以提前几个月下载测试版抢先体验一番。由于公众和开发人员都使用该软件,所以苹果公司为两者推出了developer和public版即开发者测试版的公共测试版。iOS的developer版和public版有什么区别呢?从字面上的意思来说,developer版是开发者测试版,public版是公共测试版。developer版和public版面向的对象不同。developer版是苹果公司给开发者测试使用的,需要苹果开发者帐号才可以收到下载并升级,是

linux内核有main函数;main函数是程序的入口,main是应用程序和操作系统之间约定好的一个接口名,所以linux中每个应用程序的第一个函数必须是main。

MAIN是主天线接口,而aux是辅助天线接口;大部分英特尔无线网卡主板只有数字1、2、3,其中标识的main数字为1(连灰线),aux数字为2(连黑线),如果有3,一般连白线。

主函数的一般写法如下:publicstaticvoidmain(String[]args){…}下面分别解释这些关键字的作用:(1)public关键字,这个好理解,声明主函数为public就是告诉其他的类可以访问这个函数。(2)static关键字,告知编译器main函数是一个静态函数。也就是说main函数中的代码是存储在静态存储区的,即当定义了类以后这段代码就已经存在了。如果main()方法没有使用static修饰符,那么编译不会出错,但是如果你试图执行该程序将会报错,提示

为什么必须强制main函数作为入口?这些语言都是编译语言,需要将代码编译成可执行的二进制文件。为了让操作系统/引导程序找到程序的开头,需要定义这样一个函数。简而言之,需要在大量可执行的代码中定义一个至关重要的的开头。不难看出,对于这些语言来说,main函数是不可或缺的组成部分。但是,当我们把目光转向Python时,就会发现情况大不相同。Python是一种解释语言,即脚本语言。运行过程是从上到下,逐行进行的,这意味着它的起点是已知的。每个.py文件都是一个可执行文件,可作为整个程序的入口文件,意味

Javapublic访问权限修饰符允许函数从任何位置访问,用于声明公共API、定义跨包或类共享的工具和实用程序。具体用法如下:语法:public返回值类型函数名称(参数列表){...}场景:需要从任何地方访问的函数、公共API中的方法、共享的工具或实用程序

正文开始ifname=="main":可以看成是python程序的入口,就像java中的main()方法,但不完全正确。事实上python程序是从上而下逐行运行的,在.py文件中,除了def后定义函数外的代码都会被认为是“main”方法中的内容从上而下执行。如果只是写个伟大的"helloworld",不想写函数的话,仅仅是print(‘helloworld’)就可以,这就是一个“程序”,不需要所谓的“main”方法入


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

WebStorm Mac version
Useful JavaScript development tools

Atom editor mac version download
The most popular open source editor