In Java why we write public static void main(String args[])
why not main()?
Answer Posted / srinivas_cena
public- public isa access specifier,so we can use the method from out the class
static- static is a keyword which is used to calla methos with out creation of object for a class. so jvm directly runs from main() method.
void- main() method does not return any value so it has void data type.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Difference between throw and throws?
How is it possible for two string objects with identical values not to be equal under the == operator?
Is a method a function?
What are different data structures in java?
What is operator overloading. Is it is supported in java?
If a class is declared without any access modifiers, where can the class be accessed?
How you can force the garbage collection?
How to create an interface?
If you are given the name of the function at run time how will you invoke the function?
When should I use singleton pattern?
Can we extend singleton class?
Explain what access modifiers can be used for variables?
Write a program to search a number in the given list of numbers.
What is try-with-resources in java?
Why object class is super class for every class in java?