DEV Community

velvizhi Muthu
velvizhi Muthu

Posted on

Module 4 : Main method explaination

What is the main method?

  • The Java Virtual Machine (JVM) starts program execution. -Without a properly defined main method, the JVM will not run the program

Main method declaration:
public static void main(String[] args)

Explain:

public: So the JVM can access it from anywhere.

static: So it can be called without creating an object of the class.

void: It does not return any value.

main: The specific name the JVM looks for as the entry point.

String[] args: An array parameter to accept command-line arguments.

Top comments (0)