Skip to content

Instantly share code, notes, and snippets.

@MykolaBova
Created October 1, 2016 14:54
Show Gist options
  • Save MykolaBova/47c206aa1dfc5e00d9c5d89ce447ed4d to your computer and use it in GitHub Desktop.
Save MykolaBova/47c206aa1dfc5e00d9c5d89ce447ed4d to your computer and use it in GitHub Desktop.
class ToString {
public static void main(String[] args) {
Car car = new SportCar();
System.out.println(car);
}
}
class Car {
protected int speedMax = 100;
public int getSpeedMax() {
return speedMax;
}
}
class SportCar extends Car {
protected int speedMax = 300;
public int getSpeedMax() {
return speedMax;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment