What is the output of the following code? int x = 14; System.out.println(x++); | Sololearn: Learn to code for FREE!

0

What is the output of the following code? int x = 14; System.out.println(x++);

answer 15, but it shows wrong

#15

8/8/2022 4:17:03 PM

DR.VENGATESAN.G COMMERCE-CA

3 Answers

New Answer

+5

14 because there is x++, if there was ++x it would be 15

+1

DR.VENGATESAN.G COMMERCE-CA if you were expecting 15, then it is time to review the lesson on prefix and postfix before that quiz question. Also read the Comments where you will find expanded explanations.

+1

Please use relevant tsgs for the post. At least put Java in tags for context clarity. https://code.sololearn.com/W3uiji9X28C1/?ref=app