[求助]下面代码编译出错?请大家指点
class CCirle
{
private static double pi=3.14;
private double radius;
public CCircle(double r){
radius=r;
}
public void compare(CCircle cir){
if(this==cir)
System.out.println("objects are equal");
else
System.out.println("objects are not equal");
}
}
public class app7_4
{
public static void main(String args[])
{
CCircle cir1=new CCircle(1.0);
CCircle cir2=new CCircle(2.0);
cir1.compare(cir2);
}
}
编译错误:F:\java\app7_4.java:6: 方法声明无效;需要返回类型
public CCircle(double r){
^
1 错误
Process completed.