In Java why we write public static void main(String args[])
why not main()?
Answer Posted / marrapu venkatesh.
Public: the reason for using public is to be accessed by the jvm. if u write private it should not be recognized by the jvm to execute. public methods accessed out of the class that's why we write public.
Static: the reason for static is when the program execution start main method should be invoked first. static method is called first. because we cant create object to main class to call methods. that's why we write static.
Void: In java main function does not return any value.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Are strings immutable in java?
Is array passed by reference in java?
What is Java Package and which package is imported by default?
What is oop principle in java?
What are constants and how to create constants in java?
How to invoke external process in java.
What do you understand by a Static Variable?
Hi Anyone know the model / questions of the Federal bank sample questions for the post of Specialist Officers - Programmers. Please post if anyone have..
How do you use compareto method?
Explain about the select method with an example?
Difference between current previous versions of Java?
How many types of flags are there?
How to display all the prime numbers between 1 and n (n is the number, get the input from user)
What are synchronized methods and synchronized statements in java programming?
What happens when I use / and % with a negative numerator?