英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论