class A{ protected int i = 0;}
class B extends A{
public void Add(A a){
for(int i = 0;i<10;i++){
a.i++;
System.out.println(a.i);
} }
public void Add(){
Add(this); //this 作为一个对象传入,允许
//Add(super); //不允许 }
public static void main(String argc[]){
B b = new B();
b.Add(); }}
class B extends A{
public void Add(A a){
for(int i = 0;i<10;i++){
a.i++;
System.out.println(a.i);
} }
public void Add(){
Add(this); //this 作为一个对象传入,允许
//Add(super); //不允许 }
public static void main(String argc[]){
B b = new B();
b.Add(); }}
解决方案 »
- 新人问个问题。
- 如何把字符串"1.2.3.4.5.6."中的每一个数字分别提取出来?用for语句
- 怎样使JFrame一直在程序窗口的最前面 ? 急
- JFreeCHart的问题!!急!
- 各位兄弟,帮小弟看一下这个程序啊,谢谢了哦!
- 跪求ACM程序设计入门教程
- 请问,怎么实时地判断一个文件(*.txt)变化没
- 关于JTree的Editable
- string和stringbuffer有什么区别?
- 让我无言以对:“Could not find C:/struts.jar to copy to WebApp website; file is defined as element of library struts”
- Eclipse和Netbeans该用哪个呢
- 急)帮忙改下代码。(j2se)。。。。谢谢。 在原基上改,让它不闪屏,用双缓冲,
class A{ protected int i = 0;}
class B extends A{
public void Add(A a){
for(int i = 0;i<10;i++){
a.i++;
System.out.println(a.i);
} }
public void Add(){
Add(this);
public static void main(String args[]){
B b = new B();
b.Add(); }}
Exception in thread "main" java.lang.Error: Unresolved compilation problem: at B.main(B.java:11)
protected int i = 0;
}class B extends A {
public void Add(A a) {
for (int i = 0; i < 10; i++) {
a.i++;
System.out.println(a.i);
}
} public void Add() {
Add(this);
} public static void main(String args[]) {
B b = new B();
b.Add();
}
}