What is the output? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the output?

public class Program { public static void main(String[] args) { int i=15; System. out.println (+(i++)); System.out.println (+(i--)); System.out.println (+(++i)); System.out.println (+(--i)); } }

15th Aug 2017, 5:47 AM
MAROJU PHANINDRA CHARY
MAROJU PHANINDRA CHARY - avatar
6 Answers
15th Aug 2017, 5:59 AM
Hatsy Rei
Hatsy Rei - avatar
+ 8
The + signs before the parenthesised postfix/prefix statements are redundant.
15th Aug 2017, 5:55 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
use the code playground for this ask if you want to know about the operators https://code.sololearn.com/cNgfbyl58Hri/?ref=app
15th Aug 2017, 5:50 AM
Lord Krishna
Lord Krishna - avatar
+ 3
pre decrement reduces the value of i by 1 before it is used once post decrement reduces the value of i by 1 after use once 1st time
15th Aug 2017, 5:57 AM
Lord Krishna
Lord Krishna - avatar
+ 1
Explain predecrement and post decrement operator....
15th Aug 2017, 5:54 AM
MAROJU PHANINDRA CHARY
MAROJU PHANINDRA CHARY - avatar
+ 1
I understood thanks for your explanation ☺☺
15th Aug 2017, 5:57 AM
MAROJU PHANINDRA CHARY
MAROJU PHANINDRA CHARY - avatar