Why is String[] args required in Java?

前端 未结 6 755
终归单人心
终归单人心 2020-12-03 21:33

I understand that String[] args is an array of strings passed into main as parameters.

java Print \"Hello, World!\"

 

         


        
6条回答
  •  悲&欢浪女
    2020-12-03 21:40

    It's a convention. The method is used by command line interpreter and that's how it expects it. Moreover - the compiler expects the signature in this particular form too and won't compile if you omit the parameter, for example

提交回复
热议问题