Results 1 to 2 of 2
  1. #1
    mallikanala is offline Member
    Join Date
    Jun 2011
    Posts
    10
    Rep Power
    0

    Default use of String[] args

    hi,

    public void void main(String[] args )
    {
    }


    in that wt is the use of "(String[] args)"

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,762
    Rep Power
    7

    Default

    Whatever command line arguments you pass to your program will be in the args String array.
    Java Code:
    class CommandLineArgs {
        public static void main(String[] args) {
            for(int index = 0; index < args; index++) {
                System.out.println(args[index]);
            }
        }
    }
    Run the above program with:
    java CommandLineArgs one two three apple fig dog

Similar Threads

  1. Why can't we write main without String args[]
    By shailender in forum New To Java
    Replies: 6
    Last Post: 06-17-2013, 09:28 AM
  2. Passing values to main(String args[]) ?
    By al_Marshy_1981 in forum New To Java
    Replies: 6
    Last Post: 02-21-2010, 10:16 PM
  3. String, quotes and args
    By mac in forum New To Java
    Replies: 8
    Last Post: 02-04-2010, 04:24 PM
  4. Public static void main (String args[])
    By arefeh in forum New To Java
    Replies: 12
    Last Post: 01-28-2010, 11:58 AM
  5. What does String args[] stand for?
    By Addez in forum New To Java
    Replies: 7
    Last Post: 08-19-2009, 10:24 AM

Posting Permissions

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