Created
March 19, 2017 13:18
-
-
Save fermopili/9074521b691242d9219231b9965365b7 to your computer and use it in GitHub Desktop.
com.javarush.task.task15.task1528
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
/* | |
ООП - наследование | |
*/ | |
public class Solution | |
{ | |
public static void main(String[] args) | |
{ | |
System.out.println(new Hrivna().getAmount()); | |
} | |
public static abstract class Money | |
{ | |
abstract Money getMoney(); | |
public Object getAmount() | |
{ | |
return getMoney().getAmount(); | |
} | |
} | |
//add your code below - добавь код ниже | |
public static class Hrivna extends Money | |
{ | |
public double amount = 123d; | |
public Hrivna getMoney() | |
{ | |
return this; | |
} | |
public Object getAmount() | |
{ | |
return amount; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment