Very basic programming question- compiler's starting point

Discussion in 'General Off-Topic Chat' started by jonthedit, Sep 24, 2015.

  1. jonthedit
    OP

    jonthedit GBAtemp Advanced Maniac

    Member
    1,691
    438
    May 30, 2011
    Bangladesh
    Code:
    class HelloWorld
    {
    public static void main(String[] args)
    {
    // prints Hello World! on console
    System.out.println("Hello World!");
    }
    }
    In the above JAVA HelloWorld program, where does the program begin executing the logic?
    In essence, the starting point of the program.

    The "main" is always the starting point... but is the starting point considered the bracket, or the line with main?

    I am aware one could type
    Code:
    public static void main(String[] args) {
    But that is not my question- if it is on a separate line:

    Code:
    public static void main(String[] args)
    {
    
    Which line is the true starting point for execution- the first or the second line?
     
  2. zoogie

    zoogie simple pimp tool

    Member
    6,242
    7,903
    Nov 30, 2014
    United States
    After the second {

    Doesn't matter if it's on the same line as the main() function or after.