In Java why we write public static void main(String args[])
why not main()?
Answer Posted / manik kumar bardhan
public means access specifier
static means
in general we always start execution from main()
but in java main() exist with in a class so when ever we r
executing any method which r within the class we need
instance variable to execute that method(a.print()) but here
without creating any instance main method will execute first
b/c static is the keyword which used for method then method
become a associated with class.for execution of that method
no need create instance.
void :return type
main is the method where java compiler starts execution.
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
What are the restrictions that are applied to the java static methods?
What is the benefit of lambda expressions?
Are floats faster than doubles?
Explain about fail safe iterators in java?
Can long be null in java?
What is a protected method?
Can array grow dynamically in java?
What is unicode used for?
When should we create our own custom exception classes?
What are the characteristics of Final,Finally and Finalize keywords.
when a request is generated from apache tomcat 5.5 and goes to oracle 10g or mysql,,, how the oracle or mysql reads the request as apache is a web server and oracle 10g is application server? when the oracle 10g provides response, how the apche tomcat reads it???
What is the vector class in java programming?
What is runtime locatable code?
How does hashmap work in java ?
What are actual parameters?