JSP Java


    
        Overriding Methods
    
    
        

Overriding Methods


        <%!
            javax.servlet.jsp.JspWriter localOut;
            class animal
            {
                public void breathe()  throws java.io.IOException 
                {
                    localOut.println("Breathing...
");
                }
            }
            class trout extends animal
            {
                public void breathe()  throws java.io.IOException 
                {
                    localOut.println("Gilling...
");
                }
            }
        %>     
        <%
            localOut = out;     
            out.println("Creating an animal object...
");
            animal a = new animal();
            a.breathe();
            out.println();
            out.println("Creating a trout object...
");
            trout t = new trout();
            t.breathe();
        %>