Fortunately, Java encourages you to cut down on duplicationthereby easing program developing, debugging, and maintenanceby allowing you to arrange class definitions in hierarchies that reflect natural category hierarchies.
Using Java, you can say, for example, that movies and symphonies are
attractions. Then, you can declare a minutes
instance variable in
the Attraction
class alone, because the minutes
instance
variable will appear in each Movie
instance and Symphony
instance, as though minutes
had been declared in each.