xyz3数比较
public class Hello {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int x;
int y;
int z;
System.out.println("请输入3数");
x = in.nextInt();
y = in.nextInt();
z = in.nextInt();
int max = 0;
if( x > y )
{
if( x > z )
{
max = x;
}
else
{
max = z;
}
}
else
{
if( y > z )
{
max = y;
}
else
{
max = z;
}
}
System.out.println(max);
}
}
1.其流程图是二叉树
嵌套例子
if( code = READY )
if ( count <20)
System.out.println("继续等待\n");
else
System.out.println("继续等待\n");
2.else 与最近if匹配
3.避免错误,if-else都加{}