Could you technically call the string[] anything in the main method?

前端 未结 3 666
独厮守ぢ
独厮守ぢ 2020-12-12 07:18

The header for the main method is

public static void main (String[] args)

Could you technically replace \"args\" with anything

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-12 07:46

    You can rename it to any proper Java identifier. The application needs to be able to accept multiple command-line arguments. It doesn't necessarily have to be an array, you can use varargs also.

     static void main(String... whateverYouNeed)
    

提交回复
热议问题