extends java code example
Example 1: java how to extend a class
class A{
}
class B extends A{
}
Example 2: public class extends java super
public MountainBike(int startHeight,
int startCadence,
int startSpeed,
int startGear) {
super(startCadence, startSpeed, startGear);
seatHeight = startHeight;
}
Example 3: java vererbung methoden
class Grossvater { ... }
class Vater extends Grossvater{ ... }
class Sohn extends Vater { ... }
Object refA = new Grossvater();
Object refB = new Vater();
Object refC = new Sohn();
System.out.println(""+refA instanceof Grossvater);
System.out.println(""+refB instanceof Grossvater);
System.out.println(""+refC instanceof Grossvater);