Does the Java class make sense?

Is there any difference between the following?

Example 1:

public class OddEven {

private static void OddEven() {
    //some calculation.
}

public static void main(String[] args) {
   OddEven();
}
}

Example 2:

public class OddEven {

private static void main(String[] args) {
   OddEven();
}

private static void OddEven() {
    //some calculation.
}
}

The reason I ask is because I will always go with Example 2 by first putting Main. Although most of the examples that I saw on the Internet first impose methods before Main.

I have never had official lessons, and I apologize if this is an obvious question, but I would like to know:

  • Is the layout order just aesthetic or conditional?
  • Does processing efficiency and / or memory matter?
  • If so, is this salvation visible in all programming languages?

Thanks for any help on this topic.

+3
source share
4 answers

. .

+2

, . Java .

+6

No, it doesn't matter in which order you declare the functions. It may be more convenient for you to do this in a specific order, but not for the machine.

+1
source

No, starting a Java program from the main method and the order of the function call are not important for others in which they are defined

+1
source

All Articles