sahadat49

print B C

Dec 19th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1.  
  2. package javaapplication1;
  3.  
  4. class A{
  5.  
  6. }
  7. class B extends A{
  8. void Run()
  9. {
  10. System.out.println("B");
  11. }
  12. }
  13. class C extends A{
  14. void Run()
  15. {
  16. System.out.println("C");
  17. }
  18. }
  19. public class New {
  20. public static void main(String[] args) {
  21. B obj=new B();
  22. C obj2=new C();
  23. obj.Run();
  24. obj2.Run();
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment