我需要显示三个给定数字的最大数字。 'Z'应该显示为25是最大的数字。无论如何,编译时显示出来。 Java错误'else'没有'if'
我不知道如何解决这个问题,我在课堂上给出的例子是不正确的,在网上查看时,大多数其他代码比我的复杂得多,而且帮助不大。 我的代码如下:
class Greater
{
public static void main(String args[])
{
int x = 10, y = 5, z = 15;
if (x>y) and (x>z);
{
System.out.println(x);
}
else if(y>z);
{
System.out.println(y);
}
else
{
System.out.println(z);
}
}
}
[错误的可能重复:'else'without'if'](http://stackoverflow.com/questions/13059729/error-else-without-if) – 2014-10-15 02:30:16