I was wondering. When I have two classes while the second class metalRobot
extends the first class robot
is there a way of calling the method of the first class inside of the second method which does override it?
Example
//super class
class robot{
private int width;
private int height;
//constructor
robot(int width,int height){
this.width=height;
this.width=height;
}
//display width and height
void render()
{
System.out.println(width + " " + height);
}
}
//child class
class metalRobot{
private int x;
private int y;
//constructor
metalRobot(int x,int y, int height, int width){
super(width,height);
this.x=x;
this.y=y;
}
@Override
void render()
{
System.out.println(x + " " + y);
}
}
so when i call render, it will print out x,y width and height