Search code examples
javasyntaxheaderargsmain-method

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


The header for the main method is

public static void main (String[] args)

Could you technically replace "args" with anything you want? Also, why is the parameter an array?


Solution

  • args is just a name for the argument in a method. You can rename it to whatever you want. The JVM doesn't need to know what the argument is named; only the type, String[], is important.

    dont break the start point of the app

     static void main(String[] whateverYouNeed)