Java: Classes in Java Applications by David Etheridge

by David Etheridge · Views: 150 · Format: EPUB · Language: English (en)

Cover of Java: Classes in Java Applications by David Etheridge — Free EPUB on AnyEbooksEPUB

. There is no reason why we cannot extrapolate this notion and state that any Java method can be similarly described. The description of a method is aimed at the user of the method, i.e. the code – another method – that invokes it. This means that the description of a method must be known to the developer so that other methods can invoke the method without having to know how the method is implemented. All that the calling method needs to know are the four items in the box above. For example, the calling method of the takeItemOnLoan method in the themed application is a method that calls takeItemsOnLoan when one of the buttons of the application’s GUI is pressed. Recalling the simplified code for the calling method from Chapter Four, we can see that the code shown below only needs to know that takeItemsOnLoan throws an exception and that it takes an argument of the String type, as follows: // if the button pressed is the ‘Borrow DVD’ button. { // Get the film from the list of DVDs available for loan. // Get the catalogue number of the DVD; this is a String . // Use the catalogue number to borrow the film using the member’s DVD card. // takeItemOnLoan throws an exception. try { membersCard.takeItemOnLoan( catNo ); } catch( ItemLimitException ile ) { messagesArea.setText( ile.getMessage( ) ); } } // end if The code shows that the calling method does not need to know how takeItemOnLoan is implemented in terms of its statements; the calling method calls takeItemOnLoan in the knowl

★★★★★

Rate this eBook

File Name:5e2cb8a10ab78a13c521daafef0902a7.epub
Original Title:Java: Classes in Java Applications
Creator / Author:David Etheridge
Language:English (en)
Identifier:ASIN:222390
Publisher:David Etheridge Publishing
Category:Fiction
Format:📗 EPUB eBook
File Size:3.5 MB

Community Reviews

Loading verified community reviews...

Related Fiction Titles