JAVA 编写实现方法的重载和覆盖

来源:百度知道 编辑:UC知道 时间:2024/05/19 13:04:37
急急急急急~~~~~~~~

你要程序?
class A{
int i;
public A(){};
public A(int i){
this.i=i; //被重载的构造方法
};
public void method()
{
System.out.println("the orginal method!");
}
}
class B extends A{
public void method(){
System.out.println("the Second method!");
//被覆盖的方法
}

}