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
Have you ever used hashtable and dictionary?
What are the different access modifiers available in java?
What is a linkedhashmap java?
Can we serialize static variables in java?
Why is it called a string?
What is the maximum size of array in java?
Explain the importance of thread scheduler in java?
What are the different types of constructor?
Why to use nested classes in java? (Or) what is the purpose of nested class in java?
What is the difference between public, private, protected, and friend access?
Which collection is ordered in java?
Why strings in java are called as immutable?
What is the this keyword?
What is the difference between an inner class and a sub-class?
is it possible to instantiate the math class?