34.12. Review Questions

 
[Page 129]

Chapter 5. Methods

Mayan God Shel, Mexico. Photographer: Philip Coblentz. Courtesy Brand X Pictures.

Objectives

  • To create methods, invoke methods, and pass arguments to a method ( § §5.2 “5.5).

  • To use method overloading and understand ambiguous overloading ( §5.6).

  • To determine the scope of variables ( §5.8).

  • To know how to use the methods in the Math class ( §5.9).

  • To learn the concept of method abstraction ( §5.11).

  • To design and implement methods using stepwise refinement ( §5.11).

  • (Optional) To group classes into packages ( §5.12).


[Page 130]

5.1. Introduction

In the preceding chapters, you learned about such methods as System.out.println , JOptionPane.showMessageDialog , JOptionPane.showInputDialog , Integer.parseInt , Double.parseDouble , System.exit , Math.pow , and Math.random() . A method is a collection of statements that are grouped together to perform an operation. When you call the System.out.println method, for example, the system actually executes several statements in order to display a message on the console.

This chapter introduces methods. You will learn how to create your own methods with or without return values, invoke a method with or without parameters, overload methods using the same names , and apply method abstraction in the program design.

 


Introduction to Java Programming-Comprehensive Version
Introduction to Java Programming-Comprehensive Version (6th Edition)
ISBN: B000ONFLUM
EAN: N/A
Year: 2004
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net