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
What is the difference between throw and throws keywords?
What is dynamic binding(late binding)?
What are the advantages of inner classes?
Explain about instanceof operator in java?
In multi-threading how can we ensure that a resource isn't used by multiple threads simultaneously?
Which containers use a flowlayout as their default layout in java programming?
can java object be locked down for exclusive use by a given thread? Or what happens when a thread cannot acquire a lock on an object? : Java thread
Why array is used in java?
Is java util list serializable?
what is meant by Garbage collection?
What are variable names?
Why hashmap is used in java?
Can you explain the final method modifier?
what do you understand by synchronization? Or what is synchronization and why is it important? Or describe synchronization in respect to multithreading? Or what is synchronization? : Java thread
How will you serialize a singleton class without violating singleton pattern?