+ 2

In Java : Int a = 5, b = 6; a = a++; b = a; then What is the value of a+b.?

Check your skills, but without checking program tell me the Answer is.?

4th Nov 2019, 3:40 PM
SvSatish Polnati
SvSatish Polnati - avatar
4 Réponses
+ 2
a = a++ doesn't actually change the value of a. So, a+b is 10. This is the case in Javascript at least.
4th Nov 2019, 4:28 PM
Russ
Russ - avatar
+ 1
~ swim ~ ah, fair enough. I should have thought about that and mentioned what language I was referring to.
4th Nov 2019, 6:52 PM
Russ
Russ - avatar