Terms

So why does the main method have all those crazy terms in it? So, there is some logic behind it. This are the different ways you can call your main method.

Usually people use this:

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

WHY USE THESE MODIFIERS?

  • public
  • static

WHY USE THIS RETURN TYPE?

  • void

WHY USE THIS NAME?

  • main

WHY USE AN ARRAY?

  • String[] args

inside main method

Cuz it will cost a lot of extra code, we don’t gonna write every method STATIC in the main class, because that is necessary when you don’t make an object of the main class. We make an object of the main class:

public static void main(String[]args) {
	C object = new C();
}

Place

you have to place ALL methods inside the JAVA CLASS!

place main method java

Therefore also the main method!

place main method java