Methods

Let's take a look at the basic anatomy of a Java class method.

Methods determine what functions an object can perform. In fact, another name for method is literally function.

Method: an abstraction

A class’s method is an abstraction for the user. The user only needs to know what a method does, not how a method does something.

For example, in a previous lesson, we discussed the Quadrilateral class. It may have a method to calculate the area. Let’s call it calculateArea. As a programmer, you do not need to know how ...

Get hands-on with 1400+ tech skills courses.