Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

Saturday, December 1, 2007

How to use Restricted Access in java



Using Restricted Access



Using Restricted Access


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

class vehicle
{
protected 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: