这个很简单求解释
package jj;
class add
{
int x1;
int y1;
int z1;
int one(int x){
System.out.println("调用第一个参数:");
x1=x;
return x1;
}
int two(){
System.out.println("调用第0个参数:"+(x1^2+y1^2));
return x1^2+y1^2;
}
int three(int x,int y,int z){
System.out.println("调用第三个参数:");
return x^3+y^3+z^3;
}
}
public class morning
{
public static void main(String[] args) {
add d=new add();
d.x1=3;
d.y1=9;
d.z1=9;
d.one(9);//为何不显示求出的值 啊
d.two();//干什么??????????
d.three(2, 5, 3);
System.out.println("结果:");
System.out.println(""+d.one(9));
System.out.println(""+d.two());
System.out.println(""+d.three(2,5,3));
}
}
------解决方案--------------------问:d.one(9);//为何不显示求出的值 啊
回:你没让它显示:
int one(int x) {
System.out.println("调用第一个参数:");
x1 = x;
return x1;
}
问:d.two();//干什么??????????
回:求横坐标和纵坐标和的两倍:
int two() {
System.out.println("调用第0个参数:" + (x1 ^ 2 + y1 ^ 2));
return x1 ^ 2 + y1 ^ 2;
}