Home TechnologyProgrammingJava Subscribe to RSS
 

Why Should We Give String Arguments In Java Main Method

Answer Question

2 Answers - Sort by: Date | Rating

    It allows you to provide some defined parameters that the user can input at the command prompt.  For example, this might be some user options, or parameters that can be provided to the program rather than using default values.  It is a useful way to test inputs in a program without going in and modifying the code each time.  If you provide code that actson the parameters provided, it also makes the program more flexible by giving the user some intitial input into how the program will run, and may allow the program to run more efficiently as well because you can bypass certain procedures that are not relevant to the user's needs.
    0 0

    S4074433 

    answered 3 years ago

      In java every thing is an object. The arguments in the main method can be given only through the command line. Everything you type at the command line will be treated as a String object by the JRE (java runtime environment).So we give string arguments in the main method.
      0 0

      S22p21 

      answered 3 years ago

        Answer Question - Answers are editable for 5 min.

        If you do not Sign-in or Register your answers will be anonymous,

        your answers may also be checked before going online.

        More

           
           

          Ask a Question via Twitter

          Send a question to @askblurtit and we will publish it online and send you a reply everytime you receive an answer.

          Blurtit Store

          Get T-shirts, hoodies, caps and more at the Blurtit store

          Blurtit International