大佬帮忙看看为什么不能打印第二段
aide吧
全部回复
仅看楼主
level 2
ºHKJK 楼主
public class Main
{
public static void main(String[] args)
{
int a = 100;
int b = 1000;
int min;
if (a < b)
{min=a;
// TODO: assign min
}
else
{min=b;
// TODO: assign min
}
System.out.println("The minimum of a and b is: " + min);
{
int d=5000;
int c=d;
int e=80000;
int z;
if (c<e)
{z=c;
//TODO: assign z
}
else
{z=e;
//TODO: assign z
System.out.println("help="+z);
}
}}}
这个码只能打印"The minimum of a and b is: " + min 不能打印"help="+z
2017年10月07日 02点10分 1
level 13
自己把代码认真看3遍
2017年10月07日 03点10分 2
emmmm……看了不止3遍了
2017年10月07日 04点10分
level 3
判断正确
2017年10月07日 04点10分 3

2017年10月07日 04点10分
level 8
你用了两个判断,第一个100 < 10000 min赋值100并打印,第二个5000 < 80000 z赋值5000 条件如果不成立才会打印,也就是说c的值大于8万
2017年10月07日 04点10分 4
所以就是说只有c比z大才会打印吗……
2017年10月07日 04点10分
回复 ºHKJK :不是,是c比e大才会打印吗
2017年10月07日 04点10分
但是我在第一段里也写了c比z小的时候给z赋值,那么为什么不能打印。最后那个打印必须要两端都加吗
2017年10月07日 04点10分
回复 ºHKJK :亮代码
2017年10月07日 05点10分
level 7
第二个5000是小于80000的所以执行的就是z赋值为5000,而你在此又没写要打印什么,所以自然就不会打印了
2017年10月07日 14点10分 5
1