Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Method call question!!!!

Options
  • 26-01-2004 12:22pm
    #1
    Closed Accounts Posts: 1,637 ✭✭✭


    OK, I want to call this: (The start of the programme)

    public static void main(String[] args) {

    //code.................

    }


    I want to call this so it will start @ the beginning of the code e.g. method.main();

    Thanks joePC


Comments

  • Registered Users Posts: 629 ✭✭✭str8_away


    Originally posted by joePC
    OK, I want to call this: (The start of the programme)

    public static void main(String[] args) {

    //code.................

    }


    I want to call this so it will start @ the beginning of the code e.g. method.main();

    Thanks joePC

    Main starts at the beginning of code by default.
    Unless you are writing applet.


  • Closed Accounts Posts: 137 ✭✭124124


    Once you declare a function as " public static void main(string[] args) ", Java Virtual Machine automatically identifies it as the starting/entry point of the class (or to the application, in almost all cases).

    As St8_away said, you can have main() in applet as well, but if you launch an applet with appletviewer or from browser, it would basically run init() first, instead of main.

    Hence, if you are trying to write hybrid applet-application thingee, you need to call main() from the init() of your program.

    Oh, between, www.javaranch.com is an excellent site/forum to start, advance and master Java. Its also the second largest Java website, after java.sun.com of course!

    HTH!


  • Registered Users Posts: 19,396 ✭✭✭✭Karoma


    if you can navigate your way around that sh...site. :dunno:


  • Closed Accounts Posts: 137 ✭✭124124


    Originally posted by Karoma
    if you can navigate your way around that sh...site. :dunno:

    Thats the first time I hear that comment about javaranch!

    Try their discussion forum

    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi

    Oh, between, they already have more than a hundred thousand active forum participants. Thank you very much! :)


  • Registered Users Posts: 19,396 ✭✭✭✭Karoma


    that doesn't mean the document architecture of the rest of the site is anyway decent.

    anyways, off topic. enough.


  • Advertisement
  • Closed Accounts Posts: 1,637 ✭✭✭joePC


    The site is great thx for the link, everything sorted

    thanks again joePC


Advertisement