200k views
2 votes
All objects have access to the methods of the ____________ class.

User Criticus
by
6.4k points

1 Answer

6 votes

Answer:

Super Class.

Step-by-step explanation:

The objects in the sub class or the child class have access to the super class or base class.

for example:-

class vehicle{

public int color;

public int numtyres;

public void type()

{

if(numtyres==2)

{

system.out.println("Two wheeler");

}

else if(numtyres==3)

{

system.out.println("Three wheeler");

}

else

system.out.println("four wheeler");

}

}

class motorvehicle extends vehicle{

public int gears;

public int eng_cap_cc;

}

In the above written classes class motorvehicle has access to the method type of the class vehicle and vehicle is the superclass of motorvehicle.

User Warren Stringer
by
6.2k points