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

Answer Posted / ravi

static because once the class is loaded the main() will be
invoked first.
void because main()is not returning any value.

Is This Answer Correct ?    228 Yes 99 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we have multiple catch block for a try block?

594


How many digits can a float hold?

545


Why java is not 100% object-oriented?

847


What is javac used for?

520


Can you explain the usages of class.forname()?

613






Why java is a platform independent? Explain

540


What is the relationship between clipping and repainting under awt?

623


Hi i am creating desktop application in that i want calling to mobile number. i have java telephone api (JTAPI) but i dont understand how it configure & use plese help me

1374


Can a class be defined inside an interface?

565


What are keywords in java?

588


What is return type in java?

640


What will happen to the exception object after exception handling?

588


What are the different ways of implementing thread? Which one is more advantageous?

544


Can we have two methods in a class with the same name?

588


What do you mean by global variable?

540