Predict the output.
int a = 15 , b = 10; c = 2 ;
c+=a*b- ++a ;
System.out.println("c="+c)
Answers
Answered by
14
Given cöde::
int a = 15, b = 10, c = 2;
c += a * b - ++a;
System.out.println("c=" + c);
Output::
c=136
How?::
- Three integers were declared, initialized and given a value.
- c += a * b - ++a
- 2 += 15 * 10 - 16
- 2 += 134
- 136
Know more::
The difference between prefix form of increment/decrement and post-fix form is?
==> ++i means where the value is increased now and after the use, initial value is set.
==> i++ means where the value will be increased when next use of that variable will be done. The value changes forever and initial value is lost.
I hope that my answer helps you...
Similar questions