Friday, August 3, 2018

Main Method in Java

In Java, program execution starts from "main method" which is the entry point for the program.

public static void main(String[] args) {
    // code
}

static public void main(String[] args) {
    // code
}

static public void main(String args[]) {
    // code
}

public static void main(String[] Person_Name) {
    // code
}

public static void main(String... London) {
    // code
}

In the main method we can write public or static first but it is mandatory to mention both.

No comments:

Post a Comment