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 numel matlab?

1408


Write a java program to print fibonacci series?

1007


Explain jvm, jre, and jdk?

1057


What are the advantages of java over cpp?

1127


What is balanced tree in java?

1018


How do constructors use this() and super()?

1186


What is api data?

1054


How does arraylist work in java?

1174


What is data member in java?

1151


What is the method to expand and collapse nodes in a jtree?

1097


What is thread pool in java with example?

1066


Can classes declared using the abstract keyword cab be instantiated?

1096


Can you access non static variable in static context?

1100


Is vector thread safe in java?

1097


What is class forname?

1095