Created
October 1, 2016 14:54
-
-
Save MykolaBova/47c206aa1dfc5e00d9c5d89ce447ed4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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