Main Concepts of this chapter:
Objects
Methods
Classes
Parameters
This chapter is the start of our journey into the world of object-oriented programming. Here we
introduce the most important concepts you will learn about: objects and classes. By the end of
the chapter you should have an understanding of what objects and classes are, what they are
used for, and how to interact with them. This chapter forms the basis of all other explorations in
the book.
Watch:
Read: Objects first with Java - Chapter 1
Project Files:
Concept summary
■ Object: Java objects model objects from a problem domain.
■ Class Objects are created from classes. The class describes the kind of object; the objects
represent individual instantiations of the class.
■ Method: We can communicate with objects by invoking methods on them. Objects usually do
something if we invoke a method.
■ Parameter: Methods can have parameters to provide additional information for a task.
■ Signature: The header of a method is called its signature. It provides information needed to
invoke that method.
■ Type: Parameters have types. The type defines what kinds of values a parameter
can take.
■ Multiple instances: Many similar objects can be created from a single class.
■ State: Objects have state. The state is represented by storing values in fields.
■ Method-calling: Objects can communicate by calling each other’s methods.
■ Source code: The source code of a class determines the structure and the behavior (the fields
and methods) of each of the objects in that class.
■ Result: Methods may return information about an object via a return value.