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
Which way a developer should use for creating thread, i.e. Sub classing thread or implementing runnable.
Is space a character in java?
For class CFoo { }; what default methods will the compiler generate for you>?
What do you mean by hashing?
can rmi and corba based applications interact ?
What is a singleton in genetics?
Name few java util classes introduced with java 8 ?
Is java platform independent?
Can a static block throw exception?
What are the different http methods?
Can you explain the cs option of java interpreter?
What do you mean by formatting?
What about instanceof operator in java?
What is compareto?
What is the abstraction?