go to previous page   go to home page   go to next page highlighting

public class SmallClass implements InterfaceA
{

   class definition body

}

Answer:

Yes, the definition is correct. You might wonder that it does not extend a base class, but it does.

If no other class is extended, Object is the base class. SmallClass extends Object and implements InterfaceA.


Example Problem

Let us create a database program for a store. The store sells:

There are many things that are taxable that are not goods, such as services or entertainment. Also, not all goods are taxable. So we want to have the concept taxable as a separate concept, not part of the concept of Goods. Here is what the concept Taxable looks like:

When implemented in Java, these concepts will appear as a class hierarchy and as an interface.


QUESTION 6:

(Design question: ) Decide on an implementation for each concept:

ConceptParent Class, Child Class, or Interface?
Goods
Food
Toy
Book
Taxable

go to previous page   go to home page   go to next page