publicabstractclassAbstractStragryimplementsStragryInterface { protectedvoidcommonMethodOne() { System.out.println("This is common Method One"); } protectedvoidcommonMethodTwo() { System.out.println("This is common Method Two"); } publicabstractvoidstepOne(); publicabstractvoidstepTwo(); publicvoidstragryMethod() { stepOne(); stepTwo(); } }
public classConcreStragryOneextendsAbstractStragry{ public void stepOne() { System.out.println("This is from ConcreStragryOne"); super.commonMethodOne(); } @Override public void stepTwo() { System.out.println("This is from ConcreStragryOne"); super.commonMethodTwo(); } }
public classConcreStragryTwoextendsAbstractStragry{ public void stepOne() { System.out.println("This is from ConcreStragryTwo"); super.commonMethodOne(); } @Override public void stepTwo() { System.out.println("This is from ConcreStragryTwo"); super.commonMethodTwo(); } }