1.

Find the error in each of the following code segments:

// Superclass
public class Vehicle
{
        ( Member declarations . . .)
}

// Subclass
public class Car expands Vehicle
{
         ( Member declarations . . .)
}

Describe errors with a couple of sentences of words.

2.

Find the error in each of the following code segments:

// Superclass
public class Vehicle
{
      private double cost;
      ( Other methods . . .)
}

// Subclass
public class Car extends Vehicle
{
      public Car( double c)
      {
           cost = c;
      }
}

Describe errors with a couple of sentences of words.

3.

Find the error in each of the following code segments:

// Superclass
public class Vehicle
{
     private double cost;
     public Vehicle( double c)
     {
          cost = c;
     }
     ( Other methods . . .)
}

// Subclass
public class Car extends Vehicle
{
     private int passengers;
     public Car( int p)
     {
          passengers = c;
     }
     ( Other methods . . .)
}

Describe errors with a couple of sentences of words.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *