Results 1 to 13 of 13
Like Tree1Likes
  • 1 Post By JosAH

Thread: What are command-line arguments?

  1. #1
    Kratos321's Avatar
    Kratos321 is offline Member
    Join Date
    May 2011
    Posts
    31
    Rep Power
    0

    Default What are command-line arguments?

    What are they used for? Why do you use them? How does its input/output system work?

    thanks in advance.

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,445
    Blog Entries
    7
    Rep Power
    20

    Default Re: What are command-line arguments?

    What do the tutorials have to say about them? You did read the tutorials did you?

    kind regards,

    Jos
    KevinWorkman likes this.
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Kratos321's Avatar
    Kratos321 is offline Member
    Join Date
    May 2011
    Posts
    31
    Rep Power
    0

    Default Re: What are command-line arguments?

    I did read the tutorials earlier. They only show you how to use them but now what they are.

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,317
    Rep Power
    25

    Default Re: What are command-line arguments?

    what they are.
    Command line arguments are what a user of the program would put on the command line when starting the program.

  5. #5
    Kratos321's Avatar
    Kratos321 is offline Member
    Join Date
    May 2011
    Posts
    31
    Rep Power
    0

    Default Re: What are command-line arguments?

    But why would you use the command line?

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,317
    Rep Power
    25

    Default Re: What are command-line arguments?

    Many of the programs on a computer use the commandline to get their arguments.
    When you double click on a .txt file, the editor is called with the name of the .txt file passed to it on the command line.

  7. #7
    Kratos321's Avatar
    Kratos321 is offline Member
    Join Date
    May 2011
    Posts
    31
    Rep Power
    0

    Default Re: What are command-line arguments?

    okay. but WHYYYYYYYYYYYYY?

  8. #8
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,939
    Rep Power
    8

    Default Re: What are command-line arguments?

    Quote Originally Posted by Kratos321 View Post
    okay. but WHYYYYYYYYYYYYY?
    How else would you pass in arguments to a program?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: What are command-line arguments?

    Quote Originally Posted by Kratos321 View Post
    okay. but WHYYYYYYYYYYYYY?
    You sound like my kids...:)
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #10
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,939
    Rep Power
    8

    Default Re: What are command-line arguments?

    Quote Originally Posted by Kratos321 View Post
    I did read the tutorials earlier. They only show you how to use them but now what they are.
    Actually, the tutorial contains several examples of "what they are" and why they are used: Command-Line Arguments (The Java™ Tutorials > Essential Classes > The Platform Environment)
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  11. #11
    Join Date
    Mar 2012
    Location
    Banglore
    Posts
    4
    Rep Power
    0

    Default Re: What are command-line arguments?

    hi,

    command line argument is used to provide value/data to the program at the execution time of the program.
    we can use it ,for such a program where we have to provide data at the time of execution of program.

    as for example...
    suppose we have developed such a program, in which at run time have to enter user name and password,
    and if the user name & password is wrong, then program will not execute ,otherwise program will execute.

    INPUT/OUTPUT

    if you have knowledge about static method ,then you will easly understand it.
    actually for execution of the code JVM used the class name to invoke main() method,
    it is invoke like this....

    String s[]=new String[] {"raj"},{"pass"};// here at command line argument two argument is entered ,"raj" & "pass"
    class_name.main(<arguments>);

    if we don't enter any value ,then instead of string it place 0(Zero) in the subscript, & execute the main() method...

  12. #12
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,196
    Rep Power
    19

    Default Re: What are command-line arguments?

    Most of what you state is already in the linked tutorial and hence it wasn't necessary to repeat it here; the rest is either irrelevant or wrong.

    Quote Originally Posted by raj kumar singh View Post
    String s[]=new String[] {"raj"},{"pass"};// here at command line argument two argument is entered ,"raj" & "pass"
    I suggest you review and learn how to correctly write Array Initializers.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  13. #13
    Kratos321's Avatar
    Kratos321 is offline Member
    Join Date
    May 2011
    Posts
    31
    Rep Power
    0

    Default Re: What are command-line arguments?

    what raj said is wrong?

Similar Threads

  1. Command-Line Arguments
    By smvolt in forum Eclipse
    Replies: 6
    Last Post: 12-21-2011, 01:48 PM
  2. command line arguments
    By shruthichandru in forum New To Java
    Replies: 11
    Last Post: 11-20-2010, 02:02 AM
  3. command line arguments
    By jttslg in forum Advanced Java
    Replies: 23
    Last Post: 03-24-2010, 05:06 PM
  4. Command Line Arguments
    By Nakira in forum NetBeans
    Replies: 10
    Last Post: 02-04-2010, 03:45 PM
  5. Command line arguments help
    By may88 in forum New To Java
    Replies: 8
    Last Post: 12-08-2009, 01:20 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •