class Po
{
double i,j;
public Po(){
i=0;j=0;
}
public Po(int i,int j){
this.i=i;
this.j=j;
}
public Po(double i,double j){
this.i=i;
this.j=j;
}
};
class Pop extends Po
{
int color;
public void GivePop(double x,double y,int color){
super(x,y);
this.color=color;
}
}
public class Example13
{
public static void main(String args[]){ Pop xu=new Pop();
xu.GivePop(1.2,2.3,2);
System.out.println(xu.color);
}
};
这个super怎么错了啊
是这个方法的第一个啊!
哪位告诉能告诉我吗 ?
我是才开始学的
{
double i,j;
public Po(){
i=0;j=0;
}
public Po(int i,int j){
this.i=i;
this.j=j;
}
public Po(double i,double j){
this.i=i;
this.j=j;
}
};
class Pop extends Po
{
int color;
public void GivePop(double x,double y,int color){
super(x,y);
this.color=color;
}
}
public class Example13
{
public static void main(String args[]){ Pop xu=new Pop();
xu.GivePop(1.2,2.3,2);
System.out.println(xu.color);
}
};
这个super怎么错了啊
是这个方法的第一个啊!
哪位告诉能告诉我吗 ?
我是才开始学的
解决方案 »
- JFileChooser能取得用户的桌面吗?
- swing问题,如何实现点击button弹出另一个页面,菜鸟~~~
- try异常
- 菜鸟问题,请高手指点
- 求java图象扭曲算法?
- 一個DOS命令的簡單問題!請高手解答!
- 在java中,怎么样改变当前的工作目录?
- jcreator重怎么运行带参数的程序?
- 请问能否把任何类型数据转换为一种类型,然后从这种类型又转换回去?例如:int>>Object Object>>int
- 这段话什么意思
- 这段代码到底错在哪里?
- 一个MainFrame,左边是JTree, 右边是JTable。TreeSelectionListener单独成类,JTree和JTable的实现不在MainFrame中,要实现根据JTree的
但GivePop不是构造函数啊
super必须是构造函数中第一个语句
改为:
class Po
{
double i,j;
public Po(){
i=0;j=0;
}
public Po(int i,int j){
this.i=i;
this.j=j;
}
public Po(double i,double j){
this.i=i;
this.j=j;
}
};
class Pop extends Po
{
int color;
public Pop(double x,double y,int color){
super(x,y);
this.color=color;
}
}
public class Example13
{
public static void main(String args[]){ Pop xu=new Pop(1.2,2.3,2);
System.out.println(xu.color);
}
}