could you run the java program without main method?
Answer Posted / a.d. vijaykumaran
Yes. static is powerful word in java because of within
static block inside we can define statement and then
System.exit(0); use this to avoid runtime error main thread
exception error.
class Beatme //we can use any abstract class or interface
{
static // we can't do throws Exception
{
System.out.println("A.D.Vijaykumaran");
System.exit(0);
}
}
and one disadvantage above the program as doesn't
define "System defined Exception r throws Exception" .
| Is This Answer Correct ? | 13 Yes | 2 No |
Post New Answer View All Answers
How do you add an element to an arraylist in java?
What are different types of expressions?
Can we declare an array without size in java?
Is there any sort function in java?
Describe method overriding
What is the loop in java?
What is rule of accessibility in java?
Can you declare a private method as static?
What does snprintf return?
Does java have a compiler?
List the three steps for creating an object for a class?
Explain importance of throws keyword in java?
What is empty list in java?
What is a parameter in matrices?
What is an object's lock and which object's have locks in java programming?