Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Java Problem!!!


ghost's Avatar
0 0

So, there's this Java problem on my UIL CompSci test, and I have no idea what it means. I even asked my CompSci teacher, and he's never seen it.

Can anyone tell me what this does?

int x=10,y=5,z=15;
System.out.print((x<y)?((y<z)?z:y):((x<z)?x:z));

The answer is 10, but I have no idea how. Any help would be much appreciated. –Skunk


ghost's Avatar
0 0

bump.


ghost's Avatar
0 0

basically its if statments markup(a>b)?S.o.Pl(a):S.o.Pl(b); is the same as

{
S.o.Pl(a);
}
else
{
S.o.Pl(b);
}```

so, what you have...really is```markup
if(x>y)
{
if(y>z)
{
S.o.Pl(z);
}
else
{
S.o.Pl(y)
}
}//main if
else
{
if(x<z)
{
S.o.Pl(x);
}
else
{
S.o.Pl(z);
}
}/main else```