Original Post
Hi
I wrote this program :
class elseif
{
public static void main(String args[])
{
int x=2, y=3, z=4;
if(x == 2 && y <= 3)
{
System.out.println("true!");
}
else
{
System.out.println("false!");
}
if(x == 2 || y != 2 && z * z >= 16)
{
System.out.println("true!");
}
else
{
System.out.println("false!");
}
if(y == 3 && !(z == 1))
{
System.out.println("true!");
}
else
{
System.out.println("false!");
}
if(x != 2 && y > 3)
{
System.out.println("true!");
}
else
{
System.out.println("false!");
}
if(x < y || x > z)
{
System.out.println("true!");
}
else
{
System.out.println("false!");
}
}
}
> My Question : Why does the code below not work (it shows no answers). It would be a lot easier to write
>like I did below. Thanks for help !
class elseif
{
public static void main(String args[])
{
int x=2, y=3, z=4;
if(x == 2 && y <= 3)
if(x == 2 || y != 2 && z * z >= 16)
if(y == 3 && !(z == 1))
if(x != 2 && y > 3)
if(x < y || x > z)
{
System.out.println("true!");
}
else
{
System.out.println("false!");
}
}
}