java问题..谢谢lass Point { double x,y,z; Point(double _x,double _y,double _z) { x = _x; y = _y;class Point {double x,y,z;Point(double _x,double _y,double _z) {x = _x;y = _y;z = _z;}void setX(double _x) {x = _x;}double getDistance(Point p) {return

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/09 05:12:54

java问题..谢谢lass Point { double x,y,z; Point(double _x,double _y,double _z) { x = _x; y = _y;class Point {double x,y,z;Point(double _x,double _y,double _z) {x = _x;y = _y;z = _z;}void setX(double _x) {x = _x;}double getDistance(Point p) {return
java问题..谢谢lass Point { double x,y,z; Point(double _x,double _y,double _z) { x = _x; y = _y;
class Point {
double x,y,z;
Point(double _x,double _y,double _z) {
x = _x;
y = _y;
z = _z;
}
void setX(double _x) {
x = _x;
}
double getDistance(Point p) {
return (x - p.x)*(x - p.x) + (y - p.y)*(y - p.y) + (z - p.z)*(z - p.z);
}
}
public class TestPoint {
public static void main(String[] args) {
Point p = new Point(1.0,2.0,3.0);
Point p1 = new Point(0.0,0.0,0.0);
System.out.println(p.getDistance(p1));
p.setX(5.0);
System.out.println(p.getDistance(new Point(1.0,1.0,1.0)));
}
}
其中这个方法中只有一个参数P:double getDistance(Point p)
那么下面的System.out.println(p.getDistance(new Point(1.0,1.0,1.0)));怎么把new Point的3个数给了那个getDistance里面的P..3个数怎么给一个参数?

java问题..谢谢lass Point { double x,y,z; Point(double _x,double _y,double _z) { x = _x; y = _y;class Point {double x,y,z;Point(double _x,double _y,double _z) {x = _x;y = _y;z = _z;}void setX(double _x) {x = _x;}double getDistance(Point p) {return
new Point(x,y,z)
这是一个Point 的对象吧
而getDistance 的参数不是一个数或三个数,是Point的一个对象

java问题..谢谢lass Point { double x,y,z; Point(double _x,double _y,double _z) { x = _x; y = _y;class Point {double x,y,z;Point(double _x,double _y,double _z) {x = _x;y = _y;z = _z;}void setX(double _x) {x = _x;}double getDistance(Point p) {return point p=new point() 与p= new point() 的区别JAVA菜鸟,不耻下问啦! Java数组问题 java中定义成员变量时:public Point origin;其中的Point是什么啊? 贸易条款问题的英语翻译 急 谢谢了Warehouse Storage at Point Of OriginWarehouse Labor at Point Of OriginExport PackingLoading at Point Of OriginInland FreightPort Receiving ChargesForwarders FeeLoading on Ocean CarrierOcean/Air Freight C Lass Mich Frei 歌词 英语单词point的问题point能作同位语吗? java由三点求三角形的周长public class Point {int x;int y;Point(){ }Point(int a,int b){x=a;y=b;}}public class Triangle {Point n1,n2,n3;Triangle(Point n1,Point n2,Point n3){n1=new Point();n2=new Point();n3=new Point();}double x1=Math.pow(n1.x- java java java烟花程序看不懂,初学java希望每句给出解释import java.awt.*;import java.applet.*;import java.awt.event.*;import javax.swing.*;public class Fireworks extends Applet implements MouseListener,Runnable{int x,y;int top,point;public void Java的小应用程序里面的一句代码 这代码应该怎么看 point = point = 0 --point :4; java小问题:如何建立一个point类输出正方形四个顶点坐标.一个正方形和长方形继承了矩形,然后算面积和输出顶点坐标.本来我想直接在point类中设置p1x=0,p1y=0,p2x=Quadrilateral.wid.可是系统报错说 英语翻译UNIT 01 ,10/F CARNIVAL COMM BLDG 18 JAVA RD NORTH POINT HONG KONG point point point Lass Mich So Wie Ich