Do the parameters in the main method in Java have to be String[]args?
ringa_lee
ringa_lee 2017-05-17 10:07:39
0
3
792

Ask me, does anyone know?

ringa_lee
ringa_lee

ringa_lee

reply all(3)
阿神

If you don’t know, then you think you must.

This thing is inherited from the unix (C) command.

Normally, the main function of a C program is

普通情况下这么写
int main(int argc char **argv)
有些情况下这么写
int main(int argc, char *argv[], char **env)

argc为参数数目
argv为字符串数组。
char **argv = char *argv[] = char argv[][]

You can think that in terms of the main function, java is just a layer of packaging, that is, the java packaging only cancels argc and replaces argv from a two-dimensional character matrix to a string array.

java’s args = C’s **argv,
C’s argc = java’s args.count() (or args.length())

PHPzhong

The variable name can be changed, but the String array type cannot be changed. . . .

阿神

It can also be String... args
haha

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!