Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

Sunday, December 2, 2007

How to Using Inheritance in java



Using Inheritance



Using Inheritance


<%!
javax.servlet.jsp.JspWriter localOut;

class vehicle
{
public void start() throws java.io.IOException
{
localOut.println("Starting...
");
}
}

class automobile extends vehicle
{
public void drive() throws java.io.IOException
{
localOut.println("Driving...
");
}
}
%>
<%
localOut = out;

out.println("Creating an automobile...
");
automobile a = new automobile();
a.start();
a.drive();
%>

No comments: