Is it possible to have IF statements without braces in Java, e.g:
if (x == y) z = x * y; else z = y - x;
It's possible in PHP, and I'm not sure if I'm doing something wrong.
Clarification: Here's my actual code that i'm using:
if (other instanceof Square) Square realOther = (Square) other; else Rectangle realOther = (Rectangle) other;
But i got errors like "Syntax token on realOther , delete this token" and "realOther cannot be resolved" among others.
What am I doing wrong?