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

How to run standalone mock server on local laptop

 Please download the standalone wiremock server from Direct download section at the bottom of the page.  Download and installation Feel fre...