5.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. In this chapter, you’ll learn how to declare and use methods to facilitate the design, implementation, operation and maintenance of large programs.
Previously, you’ve called methods on specific objects—for example, method nextInt on Scanner objects and methods printf
, print
and println
on the System.out
object. You’ll see that it’s possible for certain methods, called static
methods, to be called on a class rather than on an object. You’ll learn how to declare static
methods, then call them from other methods (such as main
). You’ll also learn how Java is able ...
Get Java How To Program, Late 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.