class Switch
{
public static void main(String[] args)
{
int x = 12 , y = 10 ;
int z = 0;
switch(x-y)
{
case -2 :
z = -2;
break;
case -1 :
z = -1;
break;
case 0 :
System.out.println("输入的两个数相等");
break;
case 1 :
z= 1;
break;
case 2 :
z = 2;
break;
case 3 :
z = 3;
break;
}
System.out.println(x+"比"+y+"大"+z);
}
} |
|