Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


when everything can be done by static block then why do we
use main method?.

Answers were Sorted based on User's Feedback



when everything can be done by static block then why do we use main method?...

Answer / hemanth kumar kalavagunta

Yes ... when everything can be done by static block then why
do we use main method. this is because, main method is the
only step from which compiler can enter the program to start
and this is the only way through which the data from outside
jvm can be entered into the jvm in the form of command line
arguments. using the static blocks there is no way to get
the data from the outside of the program and it is confined
to the program and program is it's world. main's world is
related both with the inside of jvm and outside of jvm.

Is This Answer Correct ?    12 Yes 0 No

when everything can be done by static block then why do we use main method?...

Answer / guest

the main block is declared as static sothat the java
interpreter could use it without instantiating it,but if we
declare everything as static there is no meaning of a class
and specifying instance variables and methods belong to
that specific class only.

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More Core Java Interview Questions

Can a method inside a interface be declared as final?

0 Answers  


Name the types of mouse event listeners ?

2 Answers  


long d =10;int i =0;i=d; /// is this possible? If d is very long number (10 digits or some thing) then?

3 Answers  


how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? : Java thread

0 Answers  


what questions are been asked ??? for interview in apti

0 Answers  


What is the purpose of declaring a variable as final?

0 Answers  


What is a parameter in a function?

0 Answers  


I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?

0 Answers  


What is the default size of arraylist in java?

0 Answers  


Can an object be null?

0 Answers  


How are Java source code files named?

3 Answers  


How destructors are defined in java?

0 Answers  


Categories