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...

Which is the best way of exception handling?

Answer Posted / sudhir dhumal

First best way is use built-in exception classes wherever possible, you don't need to create your custom exception class to represent every scenario, so try to use existing exception classes

Second best way of handling exception is creating custom exception for specific scenario by extending our class with Exception class.

Consider the following example...

public class BookSearchException extends Exception {
public BookSearchException(String message) {
super(message);
}
}

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is skeleton and stub?

1087


Does constructor return any value?

1024


What is the base class of all exception classes?

1065


What is the purpose of the runtime class in java programming?

1058


What is the method in java?

1097


What does provide mean construction?

1099


Explain where variables are created in memory?

1012


Difference between default and protected access specifiers?

1121


Difference between object and reference?

1173


Explain about instanceof operator in java?

1051


What is a null check?

1008


What is included in core java?

1058


Is java platform independent?

974


Is char a method in java?

1062


What is the importance of static variable?

1115