#java | structure | public | static | void | main | telugu | Dr.Venkat | C | CPP | Python | Program

preview_player
Показать описание
Explanation about the structure of Java Program.

Why we need to write public static void main(String args[]) in Java Program

Note:

Link for String args[] or Command line Arguments:

———————-

main(): It specifies the starting and ending points of a program to the JVM.

Without main method a Java program can be compiled but cannot executed
—————-

public: main method is to be declared as public since it is called by JVM externally from outside the class. public members can be accessed from anywhere.

public is a keyword and an access specifier specifies to access from anywhere.
—————

void:
void specifies the main method is not returning anything to the JVM. i.e., main method is nothing returning.
As per Java rule main method should not return any value.
——————

static: static methods can be accessed by using ClassName and dot.

JVM always calls the main() method by using ClassName and dot. Hence it should be declared as static.
——————-

Link for String args[] or Command line Arguments:
Рекомендации по теме
Комментарии
Автор

Understood very well about static keyword 😊

VDSHS-lo
Автор

Good Topic sir... Please do a video on String args[] sir

SriHananV
Автор

Great doing sir, Really it will be helpful to many students. You are explaining the things in a simpler manner. Thank you so much

vm-vj
visit shbcf.ru