Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the difference between the size and capacity of a vector?

1096


What are recursive functions?

1100


Wha is the output from system.out.println(“hello”+null); ?

1210


Where is const variable stored?

984


Can we clone singleton class in java?

1009


Can we sort array in java?

1005


How do you sort a string in java?

1013


Can a private method of a superclass be declared within a subclass?

1098


What is classname class in java?

1126


What is difference between length and length() method in java ?

1048


What is cr keyboard?

1339


How do you access command-line arguments within the code?

1107


Can we serialize singleton class?

1084


What does split function do in java?

1074


Explain the hierarchy of java exception classes?

1181