In Java why we write public static void main(String args[])
why not main()?

Answer Posted / anil kumar.kommmisetty

In java we using a main method
i.e public static void main(String args[])
public > This is used for any where we can access.

static > This is used for constat and then first compile to
start.
void > should not return any value.

main > where to start the compile the program to tell.

String > it is a class.

args[] > this is used to tell the when ever u enter the
data that is treated as arguments to that program.

Is This Answer Correct ?    4 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the size of boolean variable?

577


When would you use a static class?

584


What's the access scope of protected access specifier?

535


What is a local, member and a class variable?

577


What is the main method java?

534






what is interface in java? Explain

535


Why do we need data serialization?

545


What is the purpose of java?

558


What is a static class in java?

556


What is difference between overloading and overriding in java?

529


Can you declare a private method as static?

699


What are the difference between composition and inheritance in java?

515


Explain the difference between protected and default access.

518


What is multithreading in java?

551


What is Enum in Java?

686