请检查代码
为什么首先调用抽象类的构造函数
abstract class car
{
car() //creating a constructor for abstact class
{
System.out.println("four");
}
abstract String getText();
}
添加子类
public class abc extends car
{
String getText() //override the getText Method
{
return "Hello from JSP!";
}
静态块
static
{
System.out.println("Hello");
}
//空白块
{
System.out.println("two");
}
abc 的构造函数
abc()
{
super();
System.out.println("three");
}
//主要方法
public static void main(String []args)
{
abc a = new abc();
System.out.println("one");
}
}
谢谢