Results 1 to 7 of 7
  1. #1
    Zebra's Avatar
    Zebra is offline Member
    Join Date
    Apr 2008
    Location
    Louisville, Indiana/Kentucky
    Posts
    64
    Rep Power
    0

    Default What does this mean (Very Easy)

    What does this mean:
    Java Code:
    public static void main(String[] args) {
    Like what exactly does it do?

    you can just give me a simple definition, not a scientific definition.
    I am a Java n00b.

  2. #2
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    I don't know.

    Regards,
    sukatoa
    freedom exists in the world of ideas

  3. #3
    Zosden's Avatar
    Zosden is offline Senior Member
    Join Date
    Apr 2008
    Posts
    384
    Rep Power
    7

    Default

    Check out my Website I explain it in depth. It in chapter 2 link
    My IP address is 127.0.0.1

  4. #4
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    8

    Default

    This is called the 'main method' and is the entry point to your program for the JVM.

    Here is an extract from the Sun Java Tutorials:

    In the Java programming language, every application must contain a main method whose signature is:

    Java Code:
    public static void main(String[] args)
    The modifiers public and static can be written in either order (public static or static public), but the convention is to use public static as shown above. You can name the argument anything you want, but most programmers choose "args" or "argv".

    The main method is similar to the main function in C and C++; it's the entry point for your application and will subsequently invoke all the other methods required by your program.

    The main method accepts a single argument: an array of elements of type String.

    Java Code:
    public static void main([B]String[] args[/B])
    This array is the mechanism through which the runtime system passes information to your application. Each string in the array is called a command-line argument. Command-line arguments let users affect the operation of the application without recompiling it.
    Zebra, you really, REALLY need to check out the Sun Java Tutorials. They cover everything from the very beginning!! Everything you have been asking on these forums recently is covered in the tutorials in great depth with good examples that are easy to understand.

    Please take a look: The Java™ Tutorials
    Last edited by DonCash; 04-30-2008 at 04:59 PM.
    Did this post help you? Please me! :cool:

  5. #5
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    8

    Default

    Check out my Website I explain it in depth. It in chapter 2 link
    Zosden, no offense but I found your description of this to be very vague.

    static - means that I can not copy it.
    I suggest you read what static actually means:
    Q&A : What does the keyword 'static' mean?

    String args[] - don't worry about this you won't need to do anything with this.
    I know you are not actually using this in your example but for an indepth explanation of the main method it would definitely be an advantage to explain fully what this means as it becomes quite useful.
    Last edited by DonCash; 04-30-2008 at 05:01 PM.
    Did this post help you? Please me! :cool:

  6. #6
    Zebra's Avatar
    Zebra is offline Member
    Join Date
    Apr 2008
    Location
    Louisville, Indiana/Kentucky
    Posts
    64
    Rep Power
    0

    Default

    Thanks guys! Sorry I am a n00b. I will check out the tuts.
    I am a Java n00b.

  7. #7
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    8

    Default

    We've all gotta start somewhere bro!

    You'll pick up Java in no time reading those tutorials trust me. I remember when I knew no Java what so ever. Those tutorials changed all that ;)
    Did this post help you? Please me! :cool:

Similar Threads

  1. Noob question- easy
    By mattonitto in forum New To Java
    Replies: 7
    Last Post: 06-13-2008, 12:26 AM
  2. [SOLVED] Arrays/for-loops (easy) need help.
    By Zebra in forum New To Java
    Replies: 7
    Last Post: 04-24-2008, 04:03 AM
  3. help me with a realy easy program (substring)
    By michcio in forum New To Java
    Replies: 7
    Last Post: 01-27-2008, 12:41 AM
  4. Easy question
    By JavaNoob in forum New To Java
    Replies: 10
    Last Post: 08-03-2007, 10:28 PM
  5. easy way to study the java springs concept
    By kumar84 in forum New To Java
    Replies: 1
    Last Post: 07-17-2007, 03:53 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
  •