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

Write a program to check for a prime number in java?

797


What is the common usage of serialization? What exceptions occur during serialization?

816


What is core java used for?

757


What is difference between iterator and enumeration in java?

752


How many types of threads are there in java?

758


What is vector capacity in java?

842


What is array length in java?

737


How many types of interfaces are there?

781


What does ide stand for?

711


Can static methods access instance variables in java?

795


What is a string token?

730


Explain about the dynamic behavior of core java?

873


Which category the java thread do fall in?

762


What is r * in math?

740


What is passing parameters in java?

741