CIS 3931 - Elementary Java Programming
A Few More Class Examples (from Chapter 9)
- A class example representing rational numbers (fractions)
- Some classes that illustrate composition of objects
- Name.java
- class Name, first seen in chapter 8
- Address.java
- a class for creating objects that store addresses
- Person.java
- a class that has an Address object and a Name object as instance
variables. This is an example that uses composition (the "has-a"
relationship), since every Person object has a Name object and an Address
object embedded as components.