what is use of public static void main.
what is use of public static void main
Collapse
X
-
Tags: None
-
-
use of public static void main
we use public static void main because porgram execution starts with the main method so main method is must necessary in program
we use public because it is accesible to all the classes.
static reserves the memeory into the RAM
void ,it can't return any value.Comment
-
in java every thing should declared in class, so the main should written in class but executing the main is to run the program so we declare the main public static void main
in command we run the program like
>java bytecodeclass
writing the above command the JVM calls the main method inside the bytecodeclass
executing the main out side the program i.e, so we declare public
static :
static is a keyword and use of static is with out creating the object we call the methods or variables so thats why
we declare static
running program we call the bytecodeclass i.e, in which
class we write the main that bytecodeclass we called and the main method doesn't return values so we write voidComment
Comment