JSP Java


    
        Using Abstract Classes
    
    
        

Using Abstract Classes


        <%!
            javax.servlet.jsp.JspWriter localOut;
            abstract class a
            {
                abstract String getText() throws java.io.IOException;
                public void printem() throws java.io.IOException 
                {
                    localOut.println(getText());
                }
            }
            class b extends a
            {
                String getText() throws java.io.IOException 
                {
                    return "Hello from JSP!";
                }
            }
        %>     
        <%
            localOut = out;     
            b bObject = new b();
            bObject.printem();
        %>