“为什么在Java中写 ‘string [] args’?”

huangapple go评论66阅读模式
英文:

Why do we write "string [] args" in java?

问题

我只想知道在Java编程中,为什么在public static void main(String [] args)中写**String args[]**。我们还有其他数据类型,为什么要用String?

英文:

I just want to know in Java programming why do we write String args[] in public static void main(String [] args).

We have other datatypes also but why String?

答案1

得分: 3

大多数操作系统中,命令行参数是以字符串列表或数组形式传递给执行程序的。在C语言中,通常用int main(int argc, char *argv[])来表示。Java只是有一种更方便的类型。

英文:

Arguments from the command line in most operating systems are received by executing programs as a list or array of strings. In C language this is usually represented by int main(int argc, char *argv[]). Java just has a more convenient type.

huangapple
  • 本文由 发表于 2023年5月14日 20:23:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/76247460.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定