In the statement...System.out.println(x---x/0); how it is considered..it can be taken as (x--) -(x/0) aswell as (x)- (--x/0..) so for the first one ..ans is 2 second one ans is 3... i am a bit confused.....how this statement is to be considered...
I'm sorry, The last post was by mistake, i want to know what happens when an Exception occurs in catch block itself as in the above code it does but it doesn't print the exception stack trace but simply prints the output from main(). Regards, Simi
Joined: Nov 21, 2005
ven, I think your first explanation was right... prefix has a higher priority than postfix, but the expression is evaluated from left to right.
here's another one: int i = 3, j = 2; System.out.println("the expression is: " + (i---++j) +" i = "+i+", j = "+j);
quite simple i guess.
but I wonder where the precedence "prefix before postfix" ever is of importance? an expression like ++i-- is not accepted by the compiler.