Java/JSP/Abstract Class
Версия от 18:01, 31 мая 2010; (обсуждение)
Using Abstract Classes
<HTML>
<HEAD>
<TITLE>Using Abstract Classes</TITLE>
</HEAD>
<BODY>
<H1>Using Abstract Classes</H1>
<%!
javax.servlet.jsp.JspWriter localOut;
abstract class a
{
abstract String getText() throws java.io.IOException;
public void printem() throws java.io.IOException
{
localOut.println(getText());
}
}
class b extends a
{
String getText() throws java.io.IOException
{
return "Hello from JSP!";
}
}
%>
<%
localOut = out;
b bObject = new b();
bObject.printem();
%>
</BODY>
</HTML>