6.1 Introduction
Experience has shown that the best way to develop and maintain a large program is to construct it from small, simple pieces. This technique is called divide and conquer. Methods, which we introduced in Chapter 3, help you modularize programs. In this chapter, we study methods in more depth.
You’ll learn more about static
methods, which can be called without the need for an object of the class to exist. You’ll also learn how Java is able to keep track of which method is currently executing, how local variables of methods are maintained in memory and how a method knows where to return after it completes execution.
We’ll take a brief diversion into simulation techniques with random-number generation and develop a version of the ...
Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.