JSP Java Tutorial

< HTML>
    
        Using Inheritance
    
    
        

Using Inheritance


        <%!
            javax.servlet.jsp.JspWriter localOut;
            class BaseClass
            {
                public void start()  throws java.io.IOException
                {
                    localOut.println("Starting...
");
                }
            }
            class DerivedClass extends BaseClass
            {
                public void drive() throws java.io.IOException 
                {
                    localOut.println("Deriving...
");
                }
            }
        %>     
        <%
            localOut = out;     
            out.println("Creating an DerivedClass...
");
            DerivedClass a = new DerivedClass();
            a.start();
            a.drive();
        %>