Thursday, 2 February 2017

Inheritance : Is-A RelationShip



IsARelationShip .java




class Cars
{
    public void name(String name)
    {
        System.out.println("Car Name : "+name);
    }
}
public class IsARelationShip extends Cars{

    public static void main(String[] args)
    {
        IsARelationShip isARelationShip = new IsARelationShip();
        isARelationShip.name("Honda");
        isARelationShip.name("Chevrolet");
        isARelationShip.name("Volvo");

    }
}

No comments:

Post a Comment