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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Is java se open source?

570


Why does java have two ways to create child threads? Which way is better?

543


What is the mapping mechanism used by java to identify IDL language?

591


Which java version is latest?

536


Can you explain the cs option of java interpreter?

506






What is the use of arrays tostring () in java?

519


Why do we use threads in java?

561


Why is a string immutable?

546


Explain java thread life cycle.

583


Can java cast null?

597


Explain naming conventions for packages?

579


What is style and indentation?

552


How do you sort a string in java?

539


What is the difference between state-based unit testing and interaction-based unit testing?

495


What is the difference between super class & sub class?

564