Why does Java main() method accept an array of String args?

前端 未结 8 1336
情深已故
情深已故 2021-01-14 06:20

Since its possibly one of the most widely used methods of the Java language, why does it have to accept an array of Strings and doesn\'t work without it? For example, I coul

8条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-14 06:56

    even a gui driven java app will start with some main method. The "higher purpose" has never been to accept command line arguments.

    The purpose is just to accept arguments. Period. Whenever you start any program not just Java you will always need some syntax to pass arguments

提交回复
热议问题