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

Why is it called boolean?

626


What java ide should I use?

647


How do you compare values in java?

666


Is zero a positive integer?

639


What are strings in physics?

630






Which graphs are functions?

593


What is assembly condition codes?

628


What is collection class in java? List down its methods and interfaces.

621


What are recursive functions?

681


Can list be final in java?

585


State one difference between a template class and class template.

715


What is mean by exception?

642


What is meant by collection in java?

649


What classes of exceptions may be thrown by a throw statement?

631


How big is a 64 bit float?

648