Lesson 4. Class Methods and Fields

In this lesson you will:

• refactor an instance method to a class method

• learn about class variables and methods

• use the static import facility

• learn how to use compound assignment and increment operators

• understand what simple design is

• create a utility method

• learn how to judiciously use class methods

• work with the boolean primitive type

• understand why it is important that tests act as documentation

• be exposed to exceptions and stack traces

• learn more about initialization

Class Methods

Objects are a combination of behavior (implemented in Java in terms of methods) and attributes (implemented in Java in terms of fields). Attributes for an object stick around as long as the object sticks ...

Get Agile Java™: Crafting Code with Test-Driven Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.