O'Reilly logo

Technical Java™: Developing Scientific and Engineering Applications by Grant Palmer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Methods

In Chapter 8 we learned that a class can declare variables. A class can also declare methods. A method, in the simplest way of looking at it, is a named block of code that can be called from another part of a program. In non-object-oriented programming languages, such as C or Fortran, the method (or function or subroutine) is the basic building block of the program. Methods are used to divide the program into functional units. There are no access restrictions associated with a C or Fortran method. It can be called directly from anywhere in the program.

In Java, methods are an integral part of the object-oriented framework, but they are not the basic building block of a Java program—the class serves that function. Java methods ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required