< HTML>
Overriding Methods in derived class
Overriding Methods
<%!
javax.servlet.jsp.JspWriter localOut;
class BaseClass
{
public void print() throws java.io.IOException
{
localOut.println("print in base...
");
}
}
class DerivedClass extends BaseClass
{
public void print() throws java.io.IOException
{
localOut.println("print in Derived class...
");
}
}
%>
<%
localOut = out;
out.println("Creating an animal object...
");
BaseClass a = new BaseClass();
a.print();
out.println();
out.println("Creating a trout object...
");
DerivedClass t = new DerivedClass();
t.print();
%>