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. class Animal{
  8. public void move(){
  9. System.out.println("动物可以移动");
  10. }
  11. }
  12.  
  13. class Dog extends Animal{
  14. public void move(){
  15. System.out.println("狗可以跑和走");
  16. }
  17. }
  18.  
  19.  
  20. /* Name of the class has to be "Main" only if the class is public. */
  21. class Ideone
  22. {
  23. public static void main (String[] args) throws java.lang.Exception
  24. {
  25. // your code goes here
  26. System.out.println("hello, 爱看书的小沐 2022");
  27. System.out.println("Hickory,dickory,dock,");
  28. System.out.println("The mouse ran up the clock,");
  29. System.out.println("The clock struck one,");
  30.  
  31. Dog d = new Dog();
  32. d.move();
  33. }
  34. }
Success #stdin #stdout 0.09s 49128KB
stdin
Standard input is empty
stdout
hello, 爱看书的小沐 2022
Hickory,dickory,dock,
The mouse ran up the clock,
The clock struck one,
狗可以跑和走