Меня интересует, наследует ли он их косвенно? Рассмотрим следующий случай:
Код: Выделить всё
package Inheritance;
public class Bike {
private String model;
void setModel(String model){
this.model = model;
}
String getModel(){
return model;
}
}
Код: Выделить всё
package Inheritance;
public class MountainBike extends Bike{
public static void main(String[] args){
MountainBike mountainBike = new MountainBike();
mountainBike.setModel("rtx500");
System.out.println(mountainBike.getModel());
}
}
спасибо за помощь!
Подробнее здесь: https://stackoverflow.com/questions/788 ... nheritance
Мобильная версия