Overriding
Intro to Overriding Using "super"
Overloading vs. Overriding
Examples of Overriding
Overloading Examples Home
                                Overloading Examples:

public int square( int x ) {
return x * x;
}

public double square( double y ) {
return y * y;
}

Or

public Time( ) //default constructor
public Time( int hr, int min, int sec ) //general constructor
public Time( Time time ) //copy constructor

Overriding Example:

public double area( ) { // Square class method
return getSide( ) * getSide( );
}

public double area( ) { // Cube class overridden method
return super.area( ) * 6; // super.area( ) calls the Square class (superclass) version
}    
Hosted by www.Geocities.ws

1