Java Reference
In-Depth Information
4
Writing Classes
CHAPTER OBJECTIVES
Discuss the structure and content of a class definition.
Establish the concept of object state using instance data.
Describe the effect of visibility modifiers on methods and data.
Explore the structure of a method definition, including parameters and
return values.
Discuss the structure and purpose of a constructor.
Explore the creation of graphical objects.
Introduce the concepts needed to create an interactive graphical user
interface.
Explore some basic GUI components and events.
I n Chapter 3, we used classes and objects for the various services
they provide. That is, we used the predefined classes in the Java class
library that are provided to us to make the process of writing pro-
grams easier. In this chapter, we address the heart of object-oriented
programming: writing our own classes to define our own objects.
This chapter explores the basics of class definitions, including the
structure of methods and the scope and encapsulation of data. The
Graphics Track sections of this chapter discuss how to write classes
that have graphical representations and introduce the issues necessary
to create a truly interactive graphical user interface.
159
 
 
Search WWH ::




Custom Search