Hour 11. Describing What Your Object Is Like

What You’ll Learn in This Hour:

• Creating variables for an object or class

• Using methods with objects and classes

• Calling a method and returning a value

• Creating constructors

• Sending arguments to a method

• Using this to refer to an object

• Creating new objects

As you learned during last hour’s introduction to object-oriented programming (OOP), an object is a way of organizing a program so that it has everything it needs to accomplish a task. Objects consist of attributes and behavior.

Attributes are the information stored within an object. They can be variables such as integers, characters, and Boolean values, or objects such as String and Calendar objects. Behavior is the groups of statements ...

Get Sams Teach Yourself Java™ in 24 Hours, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.