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

Answer:

Yes.


Advantage of Abstract Classes

holiday card

Abstract classes are used to organize programs. The same program could be organized in many ways. Our example program could be written without an abstract class. But a real-world application might have hundreds of classes. Grouping classes together is important in keeping a program organized and understandable.

Here is a sample run of the program:

Dear Santa,

Season's Greetings!

The advantage of using an abstract class is that you can group several related classes together as siblings. The picture shows this program after its object has been constructed.

It would be nice to deal some other cards. Here is a skeleton for the Birthday class:


class Birthday extends  
{
  int age;

  public   ( String r, int years )
  {
    recipient = r;
    age = years;
  }

  public void greeting()
  {
    System.out.println("Dear " + recipient + ",\n");
    
    System.out.println("Happy " +   + "th Birthday\n\n");
  }
}

QUESTION 7:

Fill in the missing parts.