Explain public static void main(String args[]) in Java.
Good Evening Everyone????
Explain public static void main(String args[]) in Java.
public: the public is the access modifier responsible for mentioning who can access the element or the method and what is the limit.?It is responsible for making the main function globally available. It is made public so that JVM can invoke it from outside the class as it is not present in the current class.
static: static is a keyword used so that we can use the element without initiating the class so to avoid the unnecessary allocation of the memory.?
void: void is a keyword and is used to specify that a method doesn’t return anything. As the main function doesn’t return anything we use void.
main: main represents that the function declared is the main function. It helps JVM to identify that the declared function is the main function.
String args[]: It stores Java command-line arguments and is an array of type java.lang.String class.
#java #arrays #stacks #dsa #data #structures #algorithms #jvm #jdk #jre #software #developer #public #static #void #main #coding #interview #keywords