care whether there was an exception or not another legitimate way of handling exceptions is to create and throw another exceptionpossibly one that specifies the exceptional condition more precisely the following is an example of this approachcatch (arrayindexoutofboundsexception aioobxthrow new shoppinglisttoosmallexception"product index is not in the shopping list")perhaps the best way to handle an exception (although this is not always possibleis to find the problemfix itand continue execution interfaces and abstract classes in order for two objects to interactthey must "knowabout the various messages that each will acceptthat isthe methods each object supports to enforce this "knowledge,the object-oriented design paradigm asks that classes specify the application programming interface (api)or simply interfacethat their objects present to other objects in the adt-based approach (see section to data structures followed in this bookan interface defining an adt is specified as type definition and collection of methods for this typewith the arguments for each method being of specified types this specification isin turnenforced by the compiler or run-time systemwhich requires that the types of parameters that are actually passed to methods rigidly conform with the type specified in the interface this requirement is known as strong typing having to define interfaces and then having those definitions enforced by strong typing admittedly places burden on the programmerbut this burden is offset by the rewards it providesfor it enforces the encapsulation principle and often catches programming errors that would otherwise go unnoticed implementing interfaces the main structural element in java that enforces an api is the interface an interface is collection of method declarations with no data and no bodies that isthe methods of an interface are always empty (that isthey are simply method signatureswhen class implements an interfaceit must implement all of the methods declared in the interface in this wayinterfaces enforce requirements that an implementing class has methods with certain specified signatures supposefor examplethat we want to create an inventory of antiques we owncategorized as objects of various types and with various properties we mightfor