Answers for "postfix operator in java"

0

postfix operator in java

sout(X++ * ++X * X++)

1) first postfix operator: X++ 
   1.a) X++ "replaced" by 10
   1.b) X incremented by one: 10+1=11
   At this step it should look like:  System.out.println(10 * ++X * X++), X = 11;

2) second POSTfix operator: X++ 
   2.a) X++ "replaced" by 11
   2.b) X incremented by one: 11+1=12
   At this step it should look like:  System.out.println(10 * ++X * 11), X = 12;

3) prefix operator: ++X
   3.a) X incremented by one: 12+1=13
   3.b) ++X "replaced" by 13
   At this step it should look like:  System.out.println(10 * 13 * 11), X = 13;

4) evaluating 10*13 = 130, 130*11 = 1430.
Posted by: Guest on July-12-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language