JAVA 编程改错
- 提问者网友:沦陷
- 2021-06-04 23:53
{ public static void main(String args[])
{ circle mycircle=new circle(5.0);
Printcircle(mycircle);//引用传递
}
Public static void printcircle(circle c)
{System.out.println("the area of the circle of radius"+c.radius+"is"+c.findarea());}
}
class circle
{ double radius;
circle() { radius = 1.0;}
circle(double r) { radius = r; }
double findArea()
{ return radius*radius*3.14159; }}
- 五星知识达人网友:蓝房子
- 2021-06-05 00:36
class Testpassingobject{
public static void main(String args[]){
circle mycircle = new circle(5.0);
printcircle(mycircle);
}
public static void printcircle(circle c){
System.out.println("the area of the circle of radius"+c.radius+"is"+c.findArea());
}
}
class circle{
double radius;
circle() {
radius = 1.0;
}
circle(double r) {
radius = r;
}
double findArea() {
return radius*radius*3.14159;
}
}
自己看一下吧
- 1楼网友:低血压的长颈鹿
- 2021-06-05 01:52
public class circle{ double radius; circle() { radius = 1.0;} circle(double r) { radius = r; } double findArea(){ return radius*radius*3.14159; } }
public class testpassingobject{ public static void main(String args[]){ circle mycircle=new circle(5.0); printcircle(mycircle);//引用传递 } public static void printcircle(circle c){ System.out.println("the area of the circle of radius"+c.radius+"is"+c.findArea()); } }
public 应该是小写的 findarea中应该是findArea
Java中是区分大小写的
- 2楼网友:北城痞子
- 2021-06-05 01:24
应在英文状态书写