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


public static void main(String args[])


要查看或添加评论,请登录

Kapil S.的更多文章

  • What is the "Collections" API?

    What is the "Collections" API?

    Hello Everyone???? What is the "Collections" API? The Collections API is a set of classes and interfaces that support…

  • What is an exception?

    What is an exception?

    Hello Everyone???? What is an exception? An exception is a problem that arises during the execution of a program…

  • Explain the difference between abstract classes and interfaces.

    Explain the difference between abstract classes and interfaces.

    Hello Everyone???? Explain the difference between abstract classes and interfaces. Abstract Class: Can have both…

  • What is the "super" keyword?

    What is the "super" keyword?

    Hello Everyone???? What is the "super" keyword? The super keyword in Java is a reference variable that is used to refer…

  • What is the difference between a private and a protected method in Java?

    What is the difference between a private and a protected method in Java?

    Hello Everyone???? What is the difference between a private and a protected method in Java? A private method is only…

  • What is an array?

    What is an array?

    Hello Everyone???? What is an array? An array is a collection of elements of the same data type. It can be used to…

  • What is method overloading?

    What is method overloading?

    Hello Everyone???? What is method overloading? Method overloading is the polymorphism technique that allows us to…

  • What is exception handling?

    What is exception handling?

    Hello Everyone???? What is exception handling? Exception handling is a mechanism in which errors or exceptions that…

  • What is the difference between a class and an object?

    What is the difference between a class and an object?

    Hello Everyone???? What is the difference between a class and an object? A class is a blueprint or template for…

  • Explain the main difference between fail-fast and fail-safe iterators?

    Explain the main difference between fail-fast and fail-safe iterators?

    Hello Everyone???? Explain the main difference between fail-fast and fail-safe iterators? The main difference between…

社区洞察

其他会员也浏览了