该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
无聊搞了个程序,然后
System.out.println(x / y);
第十行这一句对应的输出结果是0啊,这是怎么回事。。。
源代码:
public class wonthavethechance {
public static void main(String args[]){
int x,y,z,a;
x = 100;
y = 200;
if(x>y)System.out.println("Then x > y" );
if(x
if(x==y)System.out.println("Then x = y" );
System.out.println("NEXT:");
System.out.println(x / y);
x = x * 2;
y = y / 2;
if(x>y)System.out.println("Then x > y" );
if(x
if(x==y)System.out.println("Then x = y" );
System.out.println("NEXT:");
System.out.println(x + y);
x = x / 4;
y = y * 4;
if(x>y)System.out.println("Then x > y" );
if(x
if(x==y)System.out.println("Then x = y" );
System.out.println("NEXT:");
System.out.println(x + y);
y = y / 16;
y = y * 2;
if(x>y)System.out.println("Then x > y" );
if(x
if(x==y)System.out.println("Then x = y" );
System.out.println("END.");
System.out.println(x + y);
a = 1;
z = 2;
}
}
输出结果:
Then x < y
NEXT:
0
Then x > y
NEXT:
300
Then x < y
NEXT:
450
Then x = y
END.
100
谢谢。