Title: Demonstrate pre/ post increment operators better · Issue #149 · java/devjava-content · GitHub
Open Graph Title: Demonstrate pre/ post increment operators better · Issue #149 · java/devjava-content
X Title: Demonstrate pre/ post increment operators better · Issue #149 · java/devjava-content
Description: The second code snippet from the Unary section does not illustrate the core difference between the pre and post increment operators well (++i vs i++): https://dev.java/learn/language-basics/using-operators/#unary Both System.out.println(...
Open Graph Description: The second code snippet from the Unary section does not illustrate the core difference between the pre and post increment operators well (++i vs i++): https://dev.java/learn/language-basics/using-o...
X Description: The second code snippet from the Unary section does not illustrate the core difference between the pre and post increment operators well (++i vs i++): https://dev.java/learn/language-basics/using-o...
Opengraph URL: https://github.com/java/devjava-content/issues/149
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Demonstrate pre/ post increment operators better","articleBody":"The second code snippet from the Unary section does not illustrate the core difference between the pre and post increment operators well (++i vs i++):\nhttps://dev.java/learn/language-basics/using-operators/#unary\n\nBoth \n`System.out.println(++i);`\nand\n`System.out.println(i++);`\nproduce the same output so it might be confusing as to what is the actual difference.\n\n\nI would suggest replacing it with something along the lines of\n```\nint i = 3;\n\ni++;\n// prints \"i = 4\"\nSystem.out.println(\"i = \" + i);\n\n++i;\n// prints \"i = 5\"\nSystem.out.println(\"i = \" + i);\n\nint j = ++i;\n// prints \"i = 6\"\nSystem.out.println(\"i = \" + i);\n// prints \"j = 6\"\nSystem.out.println(\"j = \" + j);\n\nint k = i++;\n// prints \"i = 7\"\nSystem.out.println(\"i = \" + i);\n// prints \"k = 6\"\nSystem.out.println(\"k = \" + k);\n```\n\n","author":{"url":"https://github.com/Locust1","@type":"Person","name":"Locust1"},"datePublished":"2025-04-05T19:09:39.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/149/devjava-content/issues/149"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:42547941-2b2c-f28a-5f5c-d84feca26a18 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 85AA:106D97:407045:57B496:6977D812 |
| html-safe-nonce | 35eb5f83e99d9a0d6bdf2a784412d389f7281936ddc9e69df8063039b5ba42a7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NUFBOjEwNkQ5Nzo0MDcwNDU6NTdCNDk2OjY5NzdEODEyIiwidmlzaXRvcl9pZCI6IjE3NTk1MzEyNjY5NDUzMDg2OTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 70f658c100e6b2c20a05ae99f024f104c66090621e9e6e84487868fa94dd9761 |
| hovercard-subject-tag | issue:2974442728 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/java/devjava-content/149/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c0720a0c8ccd891fe4c8637909934109c057b7fb9a45a105537424ec0b30f6cc/java/devjava-content/issues/149 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c0720a0c8ccd891fe4c8637909934109c057b7fb9a45a105537424ec0b30f6cc/java/devjava-content/issues/149 |
| og:image:alt | The second code snippet from the Unary section does not illustrate the core difference between the pre and post increment operators well (++i vs i++): https://dev.java/learn/language-basics/using-o... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Locust1 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 8909f95e78dc1ccc1b9acf9d5c963c2515579e48d2898151cf571437facd1d7b |
| turbo-cache-control | no-preview |
| go-import | github.com/java/devjava-content git https://github.com/java/devjava-content.git |
| octolytics-dimension-user_id | 126123820 |
| octolytics-dimension-user_login | java |
| octolytics-dimension-repository_id | 614090520 |
| octolytics-dimension-repository_nwo | java/devjava-content |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 614090520 |
| octolytics-dimension-repository_network_root_nwo | java/devjava-content |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d6b13f6e4712dc1242cf12b5e75dec8b1bf3a9ab |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width