fork download
  1. public class Zoo {
  2.  
  3. public static void main(String[] args){
  4.  
  5.  
  6. Father2 father=new Son2();
  7. System.out.println(father.name);
  8. System.out.println(father.greeting());
  9.  
  10. }
  11. }
  12.  
  13.  
  14.  
  15. class Father2{
  16. String name="Father";
  17. String getName(){
  18. return name;
  19. }
  20. String greeting(){
  21. return "calss father";
  22. }
  23. }
  24.  
  25.  
  26. class Son2 extends Father2{
  27. String mame="son";
  28. String greeting(){
  29. return "class son";
  30. }
  31.  
  32.  
  33. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1: error: expected unqualified-id before ‘public’
stdout
Standard output is empty