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