fork download
  1. class Car{
  2. String color="Black";
  3. }
  4. class Audi extends Car{
  5. String color="White";
  6. void printColor(){
  7. System.out.println("Current color "+color);
  8. System.out.println("Current color "+super.color);
  9. }
  10. }
  11. class M11 extends Audi{
  12. String color="Dark";
  13. void printColor(){
  14. System.out.println("Current color "+color);
  15. System.out.println("Current color "+super.color);
  16. }
  17. }
  18.  
  19. class Main{
  20. public static void main(String[] args){
  21. Audi car=new Audi();
  22. car.printColor();
  23. M11 caruana=new M11();
  24. caruana.printColor();
  25. }
  26. }
Success #stdin #stdout 0.1s 55516KB
stdin
Standard input is empty
stdout
Current color White
Current color Black
Current color Dark
Current color White