本帖最后由 黄敏 于 2012-8-14 09:12 编辑
还是多看看视频教程吧,里面有详细解答
给个例子你看看
public class Test03 {
public static void main(String Args[]){
BbbClass b = new BbbClass();
int z =100;
int sum1 = b.aaaMeth(z);
System.out.print(sum1);
}
}
abstract class AaaClass{
public void meth(int x, int y){
int tem = x;
x = y ;
y = tem;
}
public abstract int aaaMeth(int x);
}
class BbbClass extends AaaClass{
public int aaaMeth(int i) {
// TODO Auto-generated method stub
if(i==1){
return 1;
}
else
return i+ aaaMeth(i-1);
}
}
|