【求助】不知道这程序里面的错误怎么修改?
public class Circle
{
static double PI=3.14159265;
int radius;
public double circumference()
{
return(2*PI*radius);
}
}
{
static double PI=3.14159265;
int radius;
public double circumference()
{
return(2*PI*radius);
}
}
public class test3
{
public static void main(String args[])
{
Circle c1=new Circle();
System.out.print("put in one radius:");
BufferedReader a=new BufferedReader(new InputStreamReader(System.in));
String c1.radius=a.readLine();
Circle c2=new Circle();
System.out.print("put in another one:");
BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
String c2.radius=b.readLine();
double circum1=c1.circumference();
double circum2=c2.circumference();
System.out.println("Circle 1 is "+circum1);
System.out.println("Circle 2 is "+circum2);
}
}
{
public static void main(String args[])
{
Circle c1=new Circle();
System.out.print("put in one radius:");
BufferedReader a=new BufferedReader(new InputStreamReader(System.in));
String c1.radius=a.readLine();
Circle c2=new Circle();
System.out.print("put in another one:");
BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
String c2.radius=b.readLine();
double circum1=c1.circumference();
double circum2=c2.circumference();
System.out.println("Circle 1 is "+circum1);
System.out.println("Circle 2 is "+circum2);
}
}
初学Java,请大虾们教教,谢谢!
[[it] 本帖最后由 Jimmy_he 于 2008-12-11 22:26 编辑 [/it]]