Monday, April 23, 2018

Can a class inherit from one abstract class ?

  1. public class MyAbstractExe2 extends MyAbstractExe1
  2. {
  3. @Override
  4. void run() {
  5. System.out.println("run");
  6. }
  7. }

  8. abstract class MyAbstractExe3 {
  9. abstract void run();
  10. void test() {
  11. System.out.println("test of MyAbstractExe3 !!");
  12. }
  13. }

  14. abstract class MyAbstractExe1 {
  15. abstract void run();
  16. void test() {
  17. System.out.println("test of MyAbstractExe1 !!");
  18. }
  19. }
Yes! we can inherit a class from one abstract class. compiler will not give error.

No comments:

Post a Comment

Blueprint for self-improvement

To learn faster: Make the process fun To understand yourself : Write To understand the world better : Read To build deeper connection : Lis...