Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 3. Introduction to Classes, Objects, Methods and Strings

3. Introduction to Classes, Objects, Methods and Strings

Nothing can have value without being an object of utility.

Karl Marx

Your public servants serve you right.

Adlai E. Stevenson

You’ll see something new. Two things. And I call them Thing One and Thing Two.

Dr. Theodor Seuss Geisel

Objectives

In this chapter you’ll learn:

  • How to declare a class and use it to create an object.

  • How to implement a class’s behaviors as methods.

  • How to implement a class’s attributes as instance variables and properties.

  • How to call an object’s methods to make them perform their tasks.

  • What instance variables of a class and local variables of a method are.

  • How to use a constructor to initialize an object’s data.

  • The differences between primitive and reference types.

Outline

3.1Introduction
3.2Declaring a Class with a Method and Instantiating an Object of a Class
3.3Declaring a Method with a Parameter
3.4Instance Variables, set Methods and get Methods
3.5Primitive Types vs. Reference Types
3.6Initializing Objects with Constructors
3.7Floating-Point Numbers and Type double
3.8(Optional) GUI and Graphics Case Study: Using Dialog Boxes
3.9Wrap-Up
Summary | Self-Review Exercises | Answers to Self-Review Exercises | Exercises | Making a Difference


  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint