Results 1 to 7 of 7
  1. #1
    shailender is offline Member
    Join Date
    Nov 2008
    Posts
    1
    Rep Power
    0

    Exclamation Why can't we write main without String args[]

    can any one tell me why cannot we write main as

    public static void main(). that is without the String args[] argument.

    Tell immediately. Most Urgent..................!!!!!!!!!!

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    I was going to answer this. Seriously.

    that is until I saw this part:
    Tell immediately. Most Urgent..................!!!!!!!!!!
    You would be wise not to state this in your posts. Even if it is urgent to you, realize that it is not urgent to us. Many here take offense to this as it implies to them that a) the poster thinks that his post is more important than everyone else's, and b) that the poster wants to put pressure on the volunteers who come here to help on their own free time. Just a friendly word of advice.

    Now hopefully someone else will help you.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    yep that's the answer: because that's the way it was defined in the jls.

  6. #6
    suprativ is offline Member
    Join Date
    Jun 2013
    Posts
    1
    Rep Power
    0

    Thumbs up Re: Why can't we write main without String args[]

    Whatever the jvm interprets is the string array which is provided as arguments. I.e the variables are taken as arguments.

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

    Default Re: Why can't we write main without String args[]

    Quote Originally Posted by suprativ View Post
    Whatever the jvm interprets is the string array which is provided as arguments. I.e the variables are taken as arguments.
    Shhh ... this thread has been dead for five years; no need to wake it up.

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. How to write multiline String in a JLabel
    By JavaBean in forum AWT / Swing
    Replies: 4
    Last Post: 12-14-2009, 05:09 AM
  2. How to write a Main to test this...
    By Zombie_Leg! in forum New To Java
    Replies: 9
    Last Post: 09-27-2008, 02:30 PM
  3. problem in args
    By MS_Dark in forum New To Java
    Replies: 13
    Last Post: 08-27-2008, 01:43 AM
  4. [SOLVED] ReadLine(String fmt,Object... args) of Console class
    By Pooja Deshpande in forum New To Java
    Replies: 4
    Last Post: 04-25-2008, 05:51 AM
  5. Replies: 4
    Last Post: 03-25-2008, 12:16 PM

Posting Permissions

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