could you run the java program without main method?

Answer Posted / amit singh

please put the System.exit(0) in static block thanks
class Moon
{
static
{
System.out.println("hello i am visible without main");
System.exit();
}
}
amit singh
amising2008@gmail.com

Is This Answer Correct ?    29 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an escape character in java?

525


What is the java virtual machine?

573


Can we overload the methods by making them static?

496


How many types of design patterns are there?

522


What is lazy initialization in java?

546






What is parsing in grammar?

547


How many decimal digits is 64 bit?

522


java Technical questions asked by JPMC

4564


How many functional interfaces does java 8 have?

594


Is Java a dying language?

562


Can a class extend more than one class?

599


Why null value is used in string?

521


Is array primitive data type in java?

525


Can I learn java in 3 months?

530


What is api in java?

527