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 meant by Garbage collection?

879


Is array dynamic in java?

718


What are aggregate functions explain with examples?

818


What does sprintf return?

836


Can java list contain duplicates?

820


What is the difference between yielding and sleeping in java programming?

836


What is string builder?

680


What is passing value java?

751


Does .length start 0 java?

787


Explain thread life cycle in java?

811


Write code of any action class?

769


What is the impact of declaring a method as final?

793


What is lazy initialization in java?

775


What are 3 boolean operators?

767


What is t type java?

843