fork download
  1. class A {
  2. void show() {
  3. System.out.println("A's show");
  4. }
  5. }
  6.  
  7. class B extends A {
  8. void show() {
  9. System.out.println("B's show");
  10. }
  11.  
  12. void onlyInB() {
  13. System.out.println("onlyInB");
  14. }
  15. }
  16.  
  17. public class Main {
  18. public static void main(String[] args) {
  19. A obj = new B();
  20. obj.show();
  21. // obj.onlyInB(); // Uncomment this. What happens?
  22. }
  23. }
  24.  
Success #stdin #stdout 0.12s 52624KB
stdin
Standard input is empty
stdout
B's show