fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Vehicle{
  9. public void move(){
  10. System.out.println("Vehicle is moving");
  11. }
  12. }
  13. class Car extends Vehicle{
  14. @Override
  15. public void move(){
  16. System.out.println("Car is moving");
  17. }
  18. }
  19. class Ideone
  20. {
  21. public static void main (String[] args) throws java.lang.Exception
  22. {
  23. // your code goes here
  24. Vehicle v1 = new Car();
  25. v1.move();
  26. }
  27. }
Success #stdin #stdout 0.08s 54660KB
stdin
Standard input is empty
stdout
Car is moving