[{"data":1,"prerenderedAt":321},["ShallowReactive",2],{"tag-labels":3,"site-header":4,"article-java-boolean-char-string-en":75},{},{"featuredPost":5,"navigations":29},{"id":6,"title":7,"title_id":8,"slug":9,"excerpt":10,"excerpt_id":11,"has_translation":12,"published_at":13,"reading_time":14,"hidden_from_listing":15,"tags":16,"thumbnail_image":21,"og_image":22,"series":23,"authors":28},110,"When You Pick a Framework Just to Look Different","Ketika Pilih Framework Cuma Biar Kelihatan Beda","ketika-pilih-framework-cuma-biar-kelihatan-beda","The last time you chose a new framework or library, was it because your problem needed that tool, or because it sounded cool and few people around you were using it? That question is uncomfortable. Technology decisions are often made for reasons that never appear in any technical document.","Terakhir kali kamu milih framework atau library baru, itu karena masalahmu butuh alat itu, atau karena alatnya kedengaran keren dan belum banyak yang pakai? Pertanyaan ini nggak enak dijawab. Soalnya keputusan teknologi sering diambil dengan alasan yang nggak pernah ditulis di dokumen teknis mana pun.",true,"2026-10-06T15:25:21.000Z",5,false,[17,18,19,20],"karier","framework","opini","pengalaman",null,"\u002Fog\u002Fketika-pilih-framework-cuma-biar-kelihatan-beda.png",{"id":24,"title":25,"title_id":26,"slug":27},9,"Articles","Artikel","all",[],[30,49,70],{"collection":31,"item":32},"series",{"__typename":31,"title":25,"title_id":26,"slug":27,"children_series":33},[34,38,42,46],{"title":35,"title_id":36,"slug":37},"Artificial Intelligence","Kecerdasan Artifisial","kecerdasan-artifisial",{"title":39,"title_id":40,"slug":41},"Programming Fundamentals","Konsep Dasar Pemrograman","konsep-dasar-pemrograman",{"title":43,"title_id":44,"slug":45},"Algorithms and Data Structures","Algoritma dan Struktur Data","algoritma-struktur-data",{"title":47,"title_id":47,"slug":48},"LLM Systems","llm-systems",{"collection":31,"item":50},{"__typename":31,"title":51,"title_id":51,"slug":52,"children_series":53},"Tutorial","tutorial",[54,58,62,66],{"title":55,"title_id":56,"slug":57},"Learning Python","Belajar Python","belajar-python",{"title":59,"title_id":60,"slug":61},"Learning Go","Belajar Golang","belajar-golang",{"title":63,"title_id":64,"slug":65},"Learning Java","Belajar Java","belajar-java",{"title":67,"title_id":68,"slug":69},"Learning Pascal","Belajar Pascal","belajar-pascal",{"collection":31,"item":71},{"__typename":31,"title":72,"title_id":72,"slug":73,"children_series":74},"Lab","lab",[],{"article":76,"renderedBody":190,"renderedTakeaway":191,"latestArticles":192,"toc":301},{"id":77,"title":78,"title_id":79,"slug":80,"excerpt":81,"excerpt_id":82,"has_translation":12,"published_at":83,"reading_time":84,"hidden_from_listing":15,"tags":85,"thumbnail_image":21,"og_image":88,"series":89,"authors":181,"seoTitle":21,"seoDescription":21,"body_locale":184,"available_locales":185,"body":187,"takeway":188,"prerequisite":189},160,"Java boolean, char, and String: Why == Rejected a Matching Code","boolean, char, dan String di Java: Kenapa == Menolak Kode yang Cocok","java-boolean-char-string","The voucher program prints `INVA-2026` and then rejects it. `==` on a `String` asks whether two variables hold the same object, so a value built at run time never matches the literal.","Program voucher itu mencetak `INVA-2026` lalu menolaknya. `==` pada `String` menanyakan apakah dua variabel memegang objek yang sama, jadi nilai yang dibangun saat program berjalan tidak pernah cocok dengan literalnya.","2026-11-18T01:00:00.000Z",8,[86,87],"java","tipe-data","\u002Fog\u002Fjava-boolean-char-string.png",{"id":90,"title":91,"title_id":92,"slug":93,"description":94,"description_id":95,"articles":96,"children_series":170,"parent_series":171},22,"Variables, Types, and Operations","Variabel, Tipe Data, dan Operasi","java-variabel-tipe-data","In Java the type has to be clear from the start. We go through the primitive types, then integers and floats in more depth.","Tipe data di Java harus jelas dari awal. Kita bahas tipe data dasar, plus integer dan float lebih dalam.",[97,118,134,150,165],{"id":98,"title":99,"title_id":100,"slug":101,"excerpt":102,"excerpt_id":103,"has_translation":12,"published_at":104,"reading_time":105,"hidden_from_listing":15,"tags":106,"thumbnail_image":21,"og_image":109,"series":110,"authors":111},56,"Data Types in the Java Language","Tipe Data pada Bahasa Java","tipe-data-pada-bahasa-java","A data type is an attribute that sticks to a piece of data and decides how that data can be treated.","Tipe data adalah atribut yang menempel pada sebuah data untuk menentukan perlakuan terhadap data tersebut.","2022-12-29T00:00:00.000Z",3,[86,87,107,108],"konsep","dasar","\u002Fog\u002Ftipe-data-pada-bahasa-java.png",{"id":90,"title":91,"title_id":92,"slug":93},[112],{"authors_id":113},{"id":114,"name":115,"slug":116,"role":117,"profile_picture":21},1,"Daffa Izzuddin","izzudd","Writer",{"id":119,"title":120,"title_id":121,"slug":122,"excerpt":123,"excerpt_id":124,"has_translation":12,"published_at":125,"reading_time":126,"hidden_from_listing":15,"tags":127,"thumbnail_image":21,"og_image":129,"series":130,"authors":131},57,"Getting to Know the Integer Data Type in Java","Mengenal Tipe Data Integer pada Java","mengenal-tipe-data-integer-pada-java","Integer, as the name suggests, is a data type that only holds whole numbers (negative, zero, and positive).","Integer, sesuai namanya merupakan tipe data yang hanya bisa menampung bilangan bulat saja (negatif, nol, dan positif)","2023-01-13T00:00:00.000Z",6,[86,87,128],"integer","\u002Fog\u002Fmengenal-tipe-data-integer-pada-java.png",{"id":90,"title":91,"title_id":92,"slug":93},[132],{"authors_id":133},{"id":114,"name":115,"slug":116,"role":117,"profile_picture":21},{"id":135,"title":136,"title_id":137,"slug":138,"excerpt":139,"excerpt_id":140,"has_translation":12,"published_at":141,"reading_time":142,"hidden_from_listing":15,"tags":143,"thumbnail_image":21,"og_image":145,"series":146,"authors":147},58,"Getting to Know the Float Data Type in Java","Mengenal Tipe Data Float pada Java","mengenal-tipe-data-float-pada-java","Float, or floating point, is a data type that holds decimal and fractional number literals.","Float atau floating point merupakan tipe data yang dapat menampung literal bilangan desimal dan pecahan.","2023-02-15T00:00:00.000Z",4,[86,87,144],"float","\u002Fog\u002Fmengenal-tipe-data-float-pada-java.png",{"id":90,"title":91,"title_id":92,"slug":93},[148],{"authors_id":149},{"id":114,"name":115,"slug":116,"role":117,"profile_picture":21},{"id":151,"title":152,"title_id":153,"slug":154,"excerpt":155,"excerpt_id":156,"has_translation":12,"published_at":157,"reading_time":14,"hidden_from_listing":15,"tags":158,"thumbnail_image":21,"og_image":160,"series":161,"authors":162},137,"Java Operators: the Average That Came Out a Whole Number","Operator Java: Rata-Rata yang Keluar Sebagai Bilangan Bulat","java-operators","Three scores, one division, and the average prints as 82. Both operands are `int`, so the fraction is cut off, and the obvious cast prints `82.0` without fixing anything.","Tiga nilai, satu pembagian, dan rata-ratanya tercetak 82. Kedua operand-nya `int`, jadi pecahannya dipotong, dan cast yang paling wajar malah mencetak `82.0` tanpa memperbaiki apa pun.","2026-11-06T01:00:00.000Z",[86,159],"operator","\u002Fog\u002Fjava-operators.png",{"id":90,"title":91,"title_id":92,"slug":93},[163],{"authors_id":164},{"id":114,"name":115,"slug":116,"role":117,"profile_picture":21},{"id":77,"title":78,"title_id":79,"slug":80,"excerpt":81,"excerpt_id":82,"has_translation":12,"published_at":83,"reading_time":84,"hidden_from_listing":15,"tags":85,"thumbnail_image":21,"og_image":88,"series":166,"authors":167},{"id":90,"title":91,"title_id":92,"slug":93},[168],{"authors_id":169},{"id":114,"name":115,"slug":116,"role":117,"profile_picture":21},[],{"id":172,"title":63,"title_id":64,"slug":65,"parent_series":173,"children_series":174},13,{"id":114,"title":51,"title_id":51,"slug":52},[175,180],{"id":176,"title":177,"title_id":178,"slug":179,"cover_image":21},21,"Getting Started with Java","Berkenalan dengan Java","java-intro",{"id":90,"title":91,"title_id":92,"slug":93,"cover_image":21},[182],{"authors_id":183},{"id":114,"name":115,"slug":116,"role":117,"profile_picture":21},"en",[184,186],"id","\n`Voucher.java` reads the line `INVA-2026,ok`, keeps the part before the comma, and prints it. Then it checks that code against `INVA-2026`. Run it and `code: INVA-2026` appears on screen, followed by `verdict: not valid`.\n\n```java\n\u002F\u002F Voucher.java\npublic class Voucher {\n    public static void main(String[] args) {\n        String line = \"INVA-2026,ok\";\n        String code = line.split(\",\")[0];\n        System.out.println(\"code: \" + code);\n        if (code == \"INVA-2026\") {\n            System.out.println(\"verdict: valid\");\n        } else {\n            System.out.println(\"verdict: not valid\");\n        }\n    }\n}\n```\n\n```plain\n$ javac Voucher.java && java Voucher\ncode: INVA-2026\nverdict: not valid\n```\n\nThe bug is one `==` in the `if`, and understanding it requires three types: `boolean`, `char`, and `String`. The voucher hits the `String` comparison trap.\n\n## Two values, no numbers\n\nA `boolean` holds `true` or `false` and nothing else, and Java will not convert a number into one for you, so this does not compile:\n\n```java\n\u002F\u002F BadBoolean.java\npublic class BadBoolean {\n    public static void main(String[] args) {\n        boolean passed = 1;\n        System.out.println(passed);\n    }\n}\n```\n\n```plain\n$ javac BadBoolean.java\nBadBoolean.java:4: error: incompatible types: int cannot be converted to boolean\n        boolean passed = 1;\n                         ^\n1 error\n```\n\nJava does not treat 1 as true; you write `true`.\n\nThe `if` statement needs a `boolean` between its parentheses, and that opens a second trap. A single `=` stores a value while a double `==` compares two values, so type one `=` by mistake and Java still accepts it:\n\n```java\n\u002F\u002F AssignmentInIf.java\npublic class AssignmentInIf {\n    public static void main(String[] args) {\n        boolean passed = false;\n        if (passed = true) {\n            System.out.println(\"branch taken: \" + passed);\n        }\n        System.out.println(\"after: \" + passed);\n    }\n}\n```\n\n```plain\n$ javac AssignmentInIf.java && java AssignmentInIf\nbranch taken: true\nafter: true\n```\n\nThe variable started as `false`, the branch ran anyway, and `passed` is `true` afterwards. `passed = true` is an assignment rather than a question, so the condition is always true and the compiler accepts it without warning. It will not always tell you which operator you meant.\n\n## char is a 16-bit integer\n\nA `char` holds one character, written in single quotes like `'a'`, and underneath it is a number. It is 16 bits wide and holds one UTF-16 code unit: `Character.SIZE` is 16, `Character.BYTES` is 2, and the largest value is 65535.\n\nBecause a `char` is a number, arithmetic works on it: `'a' + 'b'` is 195, and the result is an `int` rather than a letter.\n\nAdding to a constant still fits back into a `char`, so `char next = 'a' + 1;` compiles and prints `b`. Do the same with a variable and Java refuses:\n\n```java\n\u002F\u002F BadChar.java\npublic class BadChar {\n    public static void main(String[] args) {\n        char ch = 'a';\n        char next = ch + 1;\n        System.out.println(next);\n    }\n}\n```\n\n```plain\n$ javac BadChar.java\nBadChar.java:5: error: incompatible types: possible lossy conversion from int to char\n        char next = ch + 1;\n                       ^\n1 error\n```\n\nThe expression `ch + 1` is an `int`, and an `int` may not fit in a `char`, which is why the compiler says \"possible lossy conversion\".\n\nSubtracting `'0'` from a digit character gives you the number it shows, so `'7' - '0'` is 7. Use it whenever you hold a digit as a `char` and want its value.\n\n## A String is not the text\n\nA `String` holds text, but the variable does not contain the text itself: it points to a `String` object, a thing you can ask questions with a dot, like `s.length()`.\n\nA `String` never changes after it is created, so `s.toUpperCase()` hands back a new one: with `s` set to `inva`, the variable `upper` becomes `INVA` and `s` stays `inva`.\n\n`length()` counts UTF-16 code units, the same unit a `char` holds, so an emoji written as `\"\\uD83D\\uDE00\"` has a length of 2 while `codePointCount` reports 1 character.\n\nNow back to the voucher. `==` asks whether these are the same object, `.equals()` asks whether this is the same text, and `Types.java` runs five comparisons against `INVA-2026`:\n\n```java\n\u002F\u002F Types.java\npublic class Types {\n    public static void main(String[] args) {\n        System.out.println(\"Character.SIZE = \" + Character.SIZE);\n        System.out.println(\"Character.BYTES = \" + Character.BYTES);\n        System.out.println(\"(int) Character.MAX_VALUE = \" + (int) Character.MAX_VALUE);\n        System.out.println(\"'a' + 'b' = \" + ('a' + 'b'));\n        char next = 'a' + 1;\n        System.out.println(\"char next = 'a' + 1 -> \" + next);\n        System.out.println(\"'7' - '0' = \" + ('7' - '0'));\n\n        String s = \"inva\";\n        String upper = s.toUpperCase();\n        System.out.println(\"s = \" + s + \", upper = \" + upper);\n\n        String literal = \"INVA-2026\";\n        String built = \"INVA-\" + 2026;\n        String made = new String(\"INVA-2026\");\n        String fromSplit = \"INVA-2026,ok\".split(\",\")[0];\n        System.out.println(\"literal == built     : \" + (literal == built));\n        System.out.println(\"literal == made      : \" + (literal == made));\n        System.out.println(\"literal == fromSplit : \" + (literal == fromSplit));\n        System.out.println(\"literal == made.intern() : \" + (literal == made.intern()));\n        System.out.println(\"literal.equals(made) : \" + literal.equals(made));\n\n        String emoji = \"\\uD83D\\uDE00\";\n        System.out.println(\"emoji.length() = \" + emoji.length());\n        System.out.println(\"emoji.codePointCount = \" + emoji.codePointCount(0, emoji.length()));\n    }\n}\n```\n\n```plain\n$ javac Types.java && java Types\nCharacter.SIZE = 16\nCharacter.BYTES = 2\n(int) Character.MAX_VALUE = 65535\n'a' + 'b' = 195\nchar next = 'a' + 1 -> b\n'7' - '0' = 7\ns = inva, upper = INVA\nliteral == built     : true\nliteral == made      : false\nliteral == fromSplit : false\nliteral == made.intern() : true\nliteral.equals(made) : true\nemoji.length() = 2\nemoji.codePointCount = 1\n```\n\nRead the five results. `literal == built` is `true`, because both are compile-time constants. `literal == made` is `false`, since `new String(...)` creates a new object. `literal == fromSplit` is `false` too. Calling `made.intern()` brings back the shared object, so that comparison is `true`. `literal.equals(made)` is `true`: the text is the same.\n\nThe voucher's `code` came out of `split(\",\")[0]` just like `fromSplit`, so it is not the same object as the literal and `==` said no.\n\n## A check you can run\n\nA program can find this bug for you. `CheckVoucher` reads lines, compares each one to the line it expects with `.equals()`, and prints `PASS` or `FAIL`, exiting with status 1 if any check failed. The pipe symbol `|` sends the output of `Voucher` into it.\n\n```java\n\u002F\u002F CheckVoucher.java\nimport java.util.List;\nimport java.util.Scanner;\n\npublic class CheckVoucher {\n    public static void main(String[] args) {\n        List\u003CString> expected = List.of(\"code: INVA-2026\", \"verdict: valid\");\n        Scanner in = new Scanner(System.in);\n        int passed = 0;\n        for (int i = 0; i \u003C expected.size(); i++) {\n            String got = in.hasNextLine() ? in.nextLine() : \"\u003Cnothing>\";\n            if (got.equals(expected.get(i))) {\n                passed++;\n                System.out.println(\"PASS  line \" + (i + 1) + \": \" + got);\n            } else {\n                System.out.println(\"FAIL  line \" + (i + 1) + \": expected \" + expected.get(i) + \", got \" + got);\n            }\n        }\n        if (in.hasNextLine()) {\n            System.out.println(\"FAIL  extra line: \" + in.nextLine());\n        }\n        System.out.println();\n        System.out.println(passed + \" of \" + expected.size() + \" checks passed\");\n        if (passed != expected.size()) {\n            System.exit(1);\n        }\n    }\n}\n```\n\n```plain\n$ javac CheckVoucher.java && java Voucher | java CheckVoucher\nPASS  line 1: code: INVA-2026\nFAIL  line 2: expected verdict: valid, got verdict: not valid\n\n1 of 2 checks passed\n```\n\nLine 1 passes, line 2 fails, and the run ends with exit status 1.\n\n## Ask about the text, not the object\n\nThe fix is one line: replace `==` with `.equals()`.\n\n```java\n\u002F\u002F Voucher.java\npublic class Voucher {\n    public static void main(String[] args) {\n        String line = \"INVA-2026,ok\";\n        String code = line.split(\",\")[0];\n        System.out.println(\"code: \" + code);\n        if (code.equals(\"INVA-2026\")) {\n            System.out.println(\"verdict: valid\");\n        } else {\n            System.out.println(\"verdict: not valid\");\n        }\n    }\n}\n```\n\nRun the same checker again:\n\n```plain\n$ javac Voucher.java && java Voucher | java CheckVoucher\nPASS  line 1: code: INVA-2026\nPASS  line 2: verdict: valid\n\n2 of 2 checks passed\n```\n\nBoth lines pass, the count reads `2 of 2 checks passed`, and the exit status is 0.\n\n## The checker is a second reader\n\nIn `Voucher.java`, change the code the program reads to `INVA-2027` and leave the comparison at `INVA-2026`. Run the same command.\n\n```java\n\u002F\u002F Voucher.java\npublic class Voucher {\n    public static void main(String[] args) {\n        String line = \"INVA-2027,ok\";\n        String code = line.split(\",\")[0];\n        System.out.println(\"code: \" + code);\n        if (code.equals(\"INVA-2026\")) {\n            System.out.println(\"verdict: valid\");\n        } else {\n            System.out.println(\"verdict: not valid\");\n        }\n    }\n}\n```\n\n```plain\n$ javac Voucher.java && java Voucher | java CheckVoucher\nFAIL  line 1: expected code: INVA-2026, got code: INVA-2027\nFAIL  line 2: expected verdict: valid, got verdict: not valid\n\n0 of 2 checks passed\n```\n\nBoth lines fail and the exit status is 1, because the checker still expects `INVA-2026` and reports the difference on line 1.\n\nCompare strings with `.equals()`, and use a small checker to verify the output rather than scanning it by eye.\n","- `==` on a `String` asks whether two variables hold the same object; `.equals()` asks whether two texts are the same.\n- A `String` built at run time, by `split` or by `new String`, is never the same object as the literal it matches.\n- `boolean` takes only `true` and `false`, and Java refuses to convert a number into it.\n- `if (passed = true)` is an assignment that compiles and is always true.\n- `char` is a 16-bit number in quotes: `'a' + 'b'` is 195, and `'7' - '0'` is 7.\n- A checker that compares the program's output with the expected answer catches the wrong verdict that the run itself reports as fine.",{"id":135,"title":136,"slug":138},"\u003Cp>\u003Ccode>Voucher.java\u003C\u002Fcode> reads the line \u003Ccode>INVA-2026,ok\u003C\u002Fcode>, keeps the part before the comma, and prints it. Then it checks that code against \u003Ccode>INVA-2026\u003C\u002Fcode>. Run it and \u003Ccode>code: INVA-2026\u003C\u002Fcode> appears on screen, followed by \u003Ccode>verdict: not valid\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">JAVA\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%2F%2F%20Voucher.java%0Apublic%20class%20Voucher%20%7B%0A%20%20%20%20public%20static%20void%20main(String%5B%5D%20args)%20%7B%0A%20%20%20%20%20%20%20%20String%20line%20%3D%20%22INVA-2026%2Cok%22%3B%0A%20%20%20%20%20%20%20%20String%20code%20%3D%20line.split(%22%2C%22)%5B0%5D%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22code%3A%20%22%20%2B%20code)%3B%0A%20%20%20%20%20%20%20%20if%20(code%20%3D%3D%20%22INVA-2026%22)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20System.out.println(%22verdict%3A%20valid%22)%3B%0A%20%20%20%20%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20System.out.println(%22verdict%3A%20not%20valid%22)%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">\u002F\u002F Voucher.java\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> class\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> Voucher\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> static\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> void\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> main\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">String\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">[] \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">args\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        String line \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"INVA-2026,ok\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        String code \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> line.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">split\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\",\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)[\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">];\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"code: \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> code);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (code \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">==\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"INVA-2026\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"verdict: valid\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        } \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">else\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"verdict: not valid\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\u003Cdiv class=\"code-block-wrapper code-output my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden text-[#e1e4e8] transition-all\" data-output-block>\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"code-output-mark\" aria-hidden=\"true\">&gt;_\u003C\u002Fspan>\n      \u003Cspan class=\"ml-1 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">Output\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20javac%20Voucher.java%20%26%26%20java%20Voucher%0Acode%3A%20INVA-2026%0Averdict%3A%20not%20valid\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>\u003Cspan class=\"code-output-cmd\">$ javac Voucher.java &amp;&amp; java Voucher\u003C\u002Fspan>\ncode: INVA-2026\nverdict: not valid\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>The bug is one \u003Ccode>==\u003C\u002Fcode> in the \u003Ccode>if\u003C\u002Fcode>, and understanding it requires three types: \u003Ccode>boolean\u003C\u002Fcode>, \u003Ccode>char\u003C\u002Fcode>, and \u003Ccode>String\u003C\u002Fcode>. The voucher hits the \u003Ccode>String\u003C\u002Fcode> comparison trap.\u003C\u002Fp>\n\u003Ch2 id=\"two-values-no-numbers\">Two values, no numbers\u003C\u002Fh2>\n\u003Cp>A \u003Ccode>boolean\u003C\u002Fcode> holds \u003Ccode>true\u003C\u002Fcode> or \u003Ccode>false\u003C\u002Fcode> and nothing else, and Java will not convert a number into one for you, so this does not compile:\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">JAVA\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%2F%2F%20BadBoolean.java%0Apublic%20class%20BadBoolean%20%7B%0A%20%20%20%20public%20static%20void%20main(String%5B%5D%20args)%20%7B%0A%20%20%20%20%20%20%20%20boolean%20passed%20%3D%201%3B%0A%20%20%20%20%20%20%20%20System.out.println(passed)%3B%0A%20%20%20%20%7D%0A%7D\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">\u002F\u002F BadBoolean.java\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> class\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> BadBoolean\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> static\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> void\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> main\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">String\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">[] \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">args\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        boolean\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> passed \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 1\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(passed);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\u003Cdiv class=\"code-block-wrapper code-output my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden text-[#e1e4e8] transition-all\" data-output-block>\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"code-output-mark\" aria-hidden=\"true\">&gt;_\u003C\u002Fspan>\n      \u003Cspan class=\"ml-1 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">Output\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20javac%20BadBoolean.java%0ABadBoolean.java%3A4%3A%20error%3A%20incompatible%20types%3A%20int%20cannot%20be%20converted%20to%20boolean%0A%20%20%20%20%20%20%20%20boolean%20passed%20%3D%201%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5E%0A1%20error\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>\u003Cspan class=\"code-output-cmd\">$ javac BadBoolean.java\u003C\u002Fspan>\nBadBoolean.java:4: error: incompatible types: int cannot be converted to boolean\n        boolean passed = 1;\n                         ^\n1 error\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>Java does not treat 1 as true; you write \u003Ccode>true\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cp>The \u003Ccode>if\u003C\u002Fcode> statement needs a \u003Ccode>boolean\u003C\u002Fcode> between its parentheses, and that opens a second trap. A single \u003Ccode>=\u003C\u002Fcode> stores a value while a double \u003Ccode>==\u003C\u002Fcode> compares two values, so type one \u003Ccode>=\u003C\u002Fcode> by mistake and Java still accepts it:\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">JAVA\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%2F%2F%20AssignmentInIf.java%0Apublic%20class%20AssignmentInIf%20%7B%0A%20%20%20%20public%20static%20void%20main(String%5B%5D%20args)%20%7B%0A%20%20%20%20%20%20%20%20boolean%20passed%20%3D%20false%3B%0A%20%20%20%20%20%20%20%20if%20(passed%20%3D%20true)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20System.out.println(%22branch%20taken%3A%20%22%20%2B%20passed)%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20System.out.println(%22after%3A%20%22%20%2B%20passed)%3B%0A%20%20%20%20%7D%0A%7D\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">\u002F\u002F AssignmentInIf.java\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> class\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> AssignmentInIf\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> static\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> void\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> main\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">String\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">[] \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">args\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        boolean\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> passed \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> false\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (passed \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> true\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"branch taken: \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> passed);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"after: \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> passed);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\u003Cdiv class=\"code-block-wrapper code-output my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden text-[#e1e4e8] transition-all\" data-output-block>\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"code-output-mark\" aria-hidden=\"true\">&gt;_\u003C\u002Fspan>\n      \u003Cspan class=\"ml-1 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">Output\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20javac%20AssignmentInIf.java%20%26%26%20java%20AssignmentInIf%0Abranch%20taken%3A%20true%0Aafter%3A%20true\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>\u003Cspan class=\"code-output-cmd\">$ javac AssignmentInIf.java &amp;&amp; java AssignmentInIf\u003C\u002Fspan>\nbranch taken: true\nafter: true\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>The variable started as \u003Ccode>false\u003C\u002Fcode>, the branch ran anyway, and \u003Ccode>passed\u003C\u002Fcode> is \u003Ccode>true\u003C\u002Fcode> afterwards. \u003Ccode>passed = true\u003C\u002Fcode> is an assignment rather than a question, so the condition is always true and the compiler accepts it without warning. It will not always tell you which operator you meant.\u003C\u002Fp>\n\u003Ch2 id=\"char-is-a-16-bit-integer\">char is a 16-bit integer\u003C\u002Fh2>\n\u003Cp>A \u003Ccode>char\u003C\u002Fcode> holds one character, written in single quotes like \u003Ccode>&#39;a&#39;\u003C\u002Fcode>, and underneath it is a number. It is 16 bits wide and holds one UTF-16 code unit: \u003Ccode>Character.SIZE\u003C\u002Fcode> is 16, \u003Ccode>Character.BYTES\u003C\u002Fcode> is 2, and the largest value is 65535.\u003C\u002Fp>\n\u003Cp>Because a \u003Ccode>char\u003C\u002Fcode> is a number, arithmetic works on it: \u003Ccode>&#39;a&#39; + &#39;b&#39;\u003C\u002Fcode> is 195, and the result is an \u003Ccode>int\u003C\u002Fcode> rather than a letter.\u003C\u002Fp>\n\u003Cp>Adding to a constant still fits back into a \u003Ccode>char\u003C\u002Fcode>, so \u003Ccode>char next = &#39;a&#39; + 1;\u003C\u002Fcode> compiles and prints \u003Ccode>b\u003C\u002Fcode>. Do the same with a variable and Java refuses:\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">JAVA\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%2F%2F%20BadChar.java%0Apublic%20class%20BadChar%20%7B%0A%20%20%20%20public%20static%20void%20main(String%5B%5D%20args)%20%7B%0A%20%20%20%20%20%20%20%20char%20ch%20%3D%20'a'%3B%0A%20%20%20%20%20%20%20%20char%20next%20%3D%20ch%20%2B%201%3B%0A%20%20%20%20%20%20%20%20System.out.println(next)%3B%0A%20%20%20%20%7D%0A%7D\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">\u002F\u002F BadChar.java\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> class\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> BadChar\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> static\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> void\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> main\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">String\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">[] \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">args\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        char\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> ch \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> 'a'\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        char\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> next \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> ch \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">+\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 1\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(next);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\u003Cdiv class=\"code-block-wrapper code-output my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden text-[#e1e4e8] transition-all\" data-output-block>\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"code-output-mark\" aria-hidden=\"true\">&gt;_\u003C\u002Fspan>\n      \u003Cspan class=\"ml-1 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">Output\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20javac%20BadChar.java%0ABadChar.java%3A5%3A%20error%3A%20incompatible%20types%3A%20possible%20lossy%20conversion%20from%20int%20to%20char%0A%20%20%20%20%20%20%20%20char%20next%20%3D%20ch%20%2B%201%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5E%0A1%20error\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>\u003Cspan class=\"code-output-cmd\">$ javac BadChar.java\u003C\u002Fspan>\nBadChar.java:5: error: incompatible types: possible lossy conversion from int to char\n        char next = ch + 1;\n                       ^\n1 error\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>The expression \u003Ccode>ch + 1\u003C\u002Fcode> is an \u003Ccode>int\u003C\u002Fcode>, and an \u003Ccode>int\u003C\u002Fcode> may not fit in a \u003Ccode>char\u003C\u002Fcode>, which is why the compiler says &quot;possible lossy conversion&quot;.\u003C\u002Fp>\n\u003Cp>Subtracting \u003Ccode>&#39;0&#39;\u003C\u002Fcode> from a digit character gives you the number it shows, so \u003Ccode>&#39;7&#39; - &#39;0&#39;\u003C\u002Fcode> is 7. Use it whenever you hold a digit as a \u003Ccode>char\u003C\u002Fcode> and want its value.\u003C\u002Fp>\n\u003Ch2 id=\"a-string-is-not-the-text\">A String is not the text\u003C\u002Fh2>\n\u003Cp>A \u003Ccode>String\u003C\u002Fcode> holds text, but the variable does not contain the text itself: it points to a \u003Ccode>String\u003C\u002Fcode> object, a thing you can ask questions with a dot, like \u003Ccode>s.length()\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cp>A \u003Ccode>String\u003C\u002Fcode> never changes after it is created, so \u003Ccode>s.toUpperCase()\u003C\u002Fcode> hands back a new one: with \u003Ccode>s\u003C\u002Fcode> set to \u003Ccode>inva\u003C\u002Fcode>, the variable \u003Ccode>upper\u003C\u002Fcode> becomes \u003Ccode>INVA\u003C\u002Fcode> and \u003Ccode>s\u003C\u002Fcode> stays \u003Ccode>inva\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cp>\u003Ccode>length()\u003C\u002Fcode> counts UTF-16 code units, the same unit a \u003Ccode>char\u003C\u002Fcode> holds, so an emoji written as \u003Ccode>&quot;\\uD83D\\uDE00&quot;\u003C\u002Fcode> has a length of 2 while \u003Ccode>codePointCount\u003C\u002Fcode> reports 1 character.\u003C\u002Fp>\n\u003Cp>Now back to the voucher. \u003Ccode>==\u003C\u002Fcode> asks whether these are the same object, \u003Ccode>.equals()\u003C\u002Fcode> asks whether this is the same text, and \u003Ccode>Types.java\u003C\u002Fcode> runs five comparisons against \u003Ccode>INVA-2026\u003C\u002Fcode>:\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">JAVA\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%2F%2F%20Types.java%0Apublic%20class%20Types%20%7B%0A%20%20%20%20public%20static%20void%20main(String%5B%5D%20args)%20%7B%0A%20%20%20%20%20%20%20%20System.out.println(%22Character.SIZE%20%3D%20%22%20%2B%20Character.SIZE)%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22Character.BYTES%20%3D%20%22%20%2B%20Character.BYTES)%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22(int)%20Character.MAX_VALUE%20%3D%20%22%20%2B%20(int)%20Character.MAX_VALUE)%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22'a'%20%2B%20'b'%20%3D%20%22%20%2B%20('a'%20%2B%20'b'))%3B%0A%20%20%20%20%20%20%20%20char%20next%20%3D%20'a'%20%2B%201%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22char%20next%20%3D%20'a'%20%2B%201%20-%3E%20%22%20%2B%20next)%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22'7'%20-%20'0'%20%3D%20%22%20%2B%20('7'%20-%20'0'))%3B%0A%0A%20%20%20%20%20%20%20%20String%20s%20%3D%20%22inva%22%3B%0A%20%20%20%20%20%20%20%20String%20upper%20%3D%20s.toUpperCase()%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22s%20%3D%20%22%20%2B%20s%20%2B%20%22%2C%20upper%20%3D%20%22%20%2B%20upper)%3B%0A%0A%20%20%20%20%20%20%20%20String%20literal%20%3D%20%22INVA-2026%22%3B%0A%20%20%20%20%20%20%20%20String%20built%20%3D%20%22INVA-%22%20%2B%202026%3B%0A%20%20%20%20%20%20%20%20String%20made%20%3D%20new%20String(%22INVA-2026%22)%3B%0A%20%20%20%20%20%20%20%20String%20fromSplit%20%3D%20%22INVA-2026%2Cok%22.split(%22%2C%22)%5B0%5D%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22literal%20%3D%3D%20built%20%20%20%20%20%3A%20%22%20%2B%20(literal%20%3D%3D%20built))%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22literal%20%3D%3D%20made%20%20%20%20%20%20%3A%20%22%20%2B%20(literal%20%3D%3D%20made))%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22literal%20%3D%3D%20fromSplit%20%3A%20%22%20%2B%20(literal%20%3D%3D%20fromSplit))%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22literal%20%3D%3D%20made.intern()%20%3A%20%22%20%2B%20(literal%20%3D%3D%20made.intern()))%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22literal.equals(made)%20%3A%20%22%20%2B%20literal.equals(made))%3B%0A%0A%20%20%20%20%20%20%20%20String%20emoji%20%3D%20%22%5CuD83D%5CuDE00%22%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22emoji.length()%20%3D%20%22%20%2B%20emoji.length())%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22emoji.codePointCount%20%3D%20%22%20%2B%20emoji.codePointCount(0%2C%20emoji.length()))%3B%0A%20%20%20%20%7D%0A%7D\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">\u002F\u002F Types.java\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> class\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> Types\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> static\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> void\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> main\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">String\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">[] \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">args\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"Character.SIZE = \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> Character.SIZE);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"Character.BYTES = \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> Character.BYTES);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"(int) Character.MAX_VALUE = \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">int\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) Character.MAX_VALUE);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"'a' + 'b' = \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">'a'\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> 'b'\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">));\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        char\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> next \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> 'a'\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 1\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"char next = 'a' + 1 -> \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> next);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"'7' - '0' = \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">'7'\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> -\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> '0'\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">));\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        String s \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"inva\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        String upper \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> s.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">toUpperCase\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">();\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"s = \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> s \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">+\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \", upper = \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> upper);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        String literal \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"INVA-2026\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        String built \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"INVA-\"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 2026\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        String made \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> new\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> String\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"INVA-2026\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        String fromSplit \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"INVA-2026,ok\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">split\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\",\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)[\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">];\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"literal == built     : \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (literal \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">==\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> built));\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"literal == made      : \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (literal \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">==\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> made));\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"literal == fromSplit : \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (literal \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">==\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> fromSplit));\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"literal == made.intern() : \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (literal \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">==\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> made.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">intern\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">()));\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"literal.equals(made) : \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> literal.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">equals\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(made));\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        String emoji \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">\\u\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">D83D\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">\\u\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">DE00\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"emoji.length() = \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> emoji.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">length\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">());\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"emoji.codePointCount = \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> emoji.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">codePointCount\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, emoji.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">length\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">()));\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\u003Cdiv class=\"code-block-wrapper code-output my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden text-[#e1e4e8] transition-all\" data-output-block>\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"code-output-mark\" aria-hidden=\"true\">&gt;_\u003C\u002Fspan>\n      \u003Cspan class=\"ml-1 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">Output\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20javac%20Types.java%20%26%26%20java%20Types%0ACharacter.SIZE%20%3D%2016%0ACharacter.BYTES%20%3D%202%0A(int)%20Character.MAX_VALUE%20%3D%2065535%0A'a'%20%2B%20'b'%20%3D%20195%0Achar%20next%20%3D%20'a'%20%2B%201%20-%3E%20b%0A'7'%20-%20'0'%20%3D%207%0As%20%3D%20inva%2C%20upper%20%3D%20INVA%0Aliteral%20%3D%3D%20built%20%20%20%20%20%3A%20true%0Aliteral%20%3D%3D%20made%20%20%20%20%20%20%3A%20false%0Aliteral%20%3D%3D%20fromSplit%20%3A%20false%0Aliteral%20%3D%3D%20made.intern()%20%3A%20true%0Aliteral.equals(made)%20%3A%20true%0Aemoji.length()%20%3D%202%0Aemoji.codePointCount%20%3D%201\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>\u003Cspan class=\"code-output-cmd\">$ javac Types.java &amp;&amp; java Types\u003C\u002Fspan>\nCharacter.SIZE = 16\nCharacter.BYTES = 2\n(int) Character.MAX_VALUE = 65535\n'a' + 'b' = 195\nchar next = 'a' + 1 -&gt; b\n'7' - '0' = 7\ns = inva, upper = INVA\nliteral == built     : true\nliteral == made      : false\nliteral == fromSplit : false\nliteral == made.intern() : true\nliteral.equals(made) : true\nemoji.length() = 2\nemoji.codePointCount = 1\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>Read the five results. \u003Ccode>literal == built\u003C\u002Fcode> is \u003Ccode>true\u003C\u002Fcode>, because both are compile-time constants. \u003Ccode>literal == made\u003C\u002Fcode> is \u003Ccode>false\u003C\u002Fcode>, since \u003Ccode>new String(...)\u003C\u002Fcode> creates a new object. \u003Ccode>literal == fromSplit\u003C\u002Fcode> is \u003Ccode>false\u003C\u002Fcode> too. Calling \u003Ccode>made.intern()\u003C\u002Fcode> brings back the shared object, so that comparison is \u003Ccode>true\u003C\u002Fcode>. \u003Ccode>literal.equals(made)\u003C\u002Fcode> is \u003Ccode>true\u003C\u002Fcode>: the text is the same.\u003C\u002Fp>\n\u003Cp>The voucher&#39;s \u003Ccode>code\u003C\u002Fcode> came out of \u003Ccode>split(&quot;,&quot;)[0]\u003C\u002Fcode> just like \u003Ccode>fromSplit\u003C\u002Fcode>, so it is not the same object as the literal and \u003Ccode>==\u003C\u002Fcode> said no.\u003C\u002Fp>\n\u003Ch2 id=\"a-check-you-can-run\">A check you can run\u003C\u002Fh2>\n\u003Cp>A program can find this bug for you. \u003Ccode>CheckVoucher\u003C\u002Fcode> reads lines, compares each one to the line it expects with \u003Ccode>.equals()\u003C\u002Fcode>, and prints \u003Ccode>PASS\u003C\u002Fcode> or \u003Ccode>FAIL\u003C\u002Fcode>, exiting with status 1 if any check failed. The pipe symbol \u003Ccode>|\u003C\u002Fcode> sends the output of \u003Ccode>Voucher\u003C\u002Fcode> into it.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">JAVA\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%2F%2F%20CheckVoucher.java%0Aimport%20java.util.List%3B%0Aimport%20java.util.Scanner%3B%0A%0Apublic%20class%20CheckVoucher%20%7B%0A%20%20%20%20public%20static%20void%20main(String%5B%5D%20args)%20%7B%0A%20%20%20%20%20%20%20%20List%3CString%3E%20expected%20%3D%20List.of(%22code%3A%20INVA-2026%22%2C%20%22verdict%3A%20valid%22)%3B%0A%20%20%20%20%20%20%20%20Scanner%20in%20%3D%20new%20Scanner(System.in)%3B%0A%20%20%20%20%20%20%20%20int%20passed%20%3D%200%3B%0A%20%20%20%20%20%20%20%20for%20(int%20i%20%3D%200%3B%20i%20%3C%20expected.size()%3B%20i%2B%2B)%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20String%20got%20%3D%20in.hasNextLine()%20%3F%20in.nextLine()%20%3A%20%22%3Cnothing%3E%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20(got.equals(expected.get(i)))%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20passed%2B%2B%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20System.out.println(%22PASS%20%20line%20%22%20%2B%20(i%20%2B%201)%20%2B%20%22%3A%20%22%20%2B%20got)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20System.out.println(%22FAIL%20%20line%20%22%20%2B%20(i%20%2B%201)%20%2B%20%22%3A%20expected%20%22%20%2B%20expected.get(i)%20%2B%20%22%2C%20got%20%22%20%2B%20got)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20if%20(in.hasNextLine())%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20System.out.println(%22FAIL%20%20extra%20line%3A%20%22%20%2B%20in.nextLine())%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20System.out.println()%3B%0A%20%20%20%20%20%20%20%20System.out.println(passed%20%2B%20%22%20of%20%22%20%2B%20expected.size()%20%2B%20%22%20checks%20passed%22)%3B%0A%20%20%20%20%20%20%20%20if%20(passed%20!%3D%20expected.size())%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20System.exit(1)%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">\u002F\u002F CheckVoucher.java\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> java.util.List;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> java.util.Scanner;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> class\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> CheckVoucher\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> static\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> void\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> main\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">String\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">[] \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">args\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        List&#x3C;\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">String\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">> expected \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> List.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">of\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"code: INVA-2026\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"verdict: valid\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        Scanner in \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> new\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> Scanner\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(System.in);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        int\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> passed \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">int\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> i \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">; i \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">&#x3C;\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> expected.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">size\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(); i\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">++\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            String got \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> in.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">hasNextLine\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">() \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">?\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> in.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">nextLine\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">() \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">:\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"&#x3C;nothing>\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">            if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (got.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">equals\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(expected.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">get\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(i))) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">                passed\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">++\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">                System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"PASS  line \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (i \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">+\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 1\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">+\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \": \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> got);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            } \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">else\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">                System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"FAIL  line \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (i \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">+\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 1\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">+\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \": expected \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> expected.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">get\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(i) \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">+\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \", got \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> got);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (in.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">hasNextLine\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">()) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"FAIL  extra line: \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> in.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">nextLine\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">());\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">();\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(passed \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">+\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \" of \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> expected.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">size\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">() \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">+\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \" checks passed\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (passed \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">!=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> expected.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">size\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">()) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            System.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">exit\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">1\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\u003Cdiv class=\"code-block-wrapper code-output my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden text-[#e1e4e8] transition-all\" data-output-block>\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"code-output-mark\" aria-hidden=\"true\">&gt;_\u003C\u002Fspan>\n      \u003Cspan class=\"ml-1 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">Output\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20javac%20CheckVoucher.java%20%26%26%20java%20Voucher%20%7C%20java%20CheckVoucher%0APASS%20%20line%201%3A%20code%3A%20INVA-2026%0AFAIL%20%20line%202%3A%20expected%20verdict%3A%20valid%2C%20got%20verdict%3A%20not%20valid%0A%0A1%20of%202%20checks%20passed\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>\u003Cspan class=\"code-output-cmd\">$ javac CheckVoucher.java &amp;&amp; java Voucher | java CheckVoucher\u003C\u002Fspan>\nPASS  line 1: code: INVA-2026\nFAIL  line 2: expected verdict: valid, got verdict: not valid\n\n1 of 2 checks passed\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>Line 1 passes, line 2 fails, and the run ends with exit status 1.\u003C\u002Fp>\n\u003Ch2 id=\"ask-about-the-text-not-the-object\">Ask about the text, not the object\u003C\u002Fh2>\n\u003Cp>The fix is one line: replace \u003Ccode>==\u003C\u002Fcode> with \u003Ccode>.equals()\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">JAVA\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%2F%2F%20Voucher.java%0Apublic%20class%20Voucher%20%7B%0A%20%20%20%20public%20static%20void%20main(String%5B%5D%20args)%20%7B%0A%20%20%20%20%20%20%20%20String%20line%20%3D%20%22INVA-2026%2Cok%22%3B%0A%20%20%20%20%20%20%20%20String%20code%20%3D%20line.split(%22%2C%22)%5B0%5D%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22code%3A%20%22%20%2B%20code)%3B%0A%20%20%20%20%20%20%20%20if%20(code.equals(%22INVA-2026%22))%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20System.out.println(%22verdict%3A%20valid%22)%3B%0A%20%20%20%20%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20System.out.println(%22verdict%3A%20not%20valid%22)%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">\u002F\u002F Voucher.java\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> class\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> Voucher\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> static\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> void\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> main\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">String\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">[] \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">args\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        String line \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"INVA-2026,ok\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        String code \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> line.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">split\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\",\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)[\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">];\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"code: \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> code);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (code.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">equals\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"INVA-2026\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"verdict: valid\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        } \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">else\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"verdict: not valid\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>Run the same checker again:\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper code-output my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden text-[#e1e4e8] transition-all\" data-output-block>\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"code-output-mark\" aria-hidden=\"true\">&gt;_\u003C\u002Fspan>\n      \u003Cspan class=\"ml-1 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">Output\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20javac%20Voucher.java%20%26%26%20java%20Voucher%20%7C%20java%20CheckVoucher%0APASS%20%20line%201%3A%20code%3A%20INVA-2026%0APASS%20%20line%202%3A%20verdict%3A%20valid%0A%0A2%20of%202%20checks%20passed\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>\u003Cspan class=\"code-output-cmd\">$ javac Voucher.java &amp;&amp; java Voucher | java CheckVoucher\u003C\u002Fspan>\nPASS  line 1: code: INVA-2026\nPASS  line 2: verdict: valid\n\n2 of 2 checks passed\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>Both lines pass, the count reads \u003Ccode>2 of 2 checks passed\u003C\u002Fcode>, and the exit status is 0.\u003C\u002Fp>\n\u003Ch2 id=\"the-checker-is-a-second-reader\">The checker is a second reader\u003C\u002Fh2>\n\u003Cp>In \u003Ccode>Voucher.java\u003C\u002Fcode>, change the code the program reads to \u003Ccode>INVA-2027\u003C\u002Fcode> and leave the comparison at \u003Ccode>INVA-2026\u003C\u002Fcode>. Run the same command.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">JAVA\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%2F%2F%20Voucher.java%0Apublic%20class%20Voucher%20%7B%0A%20%20%20%20public%20static%20void%20main(String%5B%5D%20args)%20%7B%0A%20%20%20%20%20%20%20%20String%20line%20%3D%20%22INVA-2027%2Cok%22%3B%0A%20%20%20%20%20%20%20%20String%20code%20%3D%20line.split(%22%2C%22)%5B0%5D%3B%0A%20%20%20%20%20%20%20%20System.out.println(%22code%3A%20%22%20%2B%20code)%3B%0A%20%20%20%20%20%20%20%20if%20(code.equals(%22INVA-2026%22))%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20System.out.println(%22verdict%3A%20valid%22)%3B%0A%20%20%20%20%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20System.out.println(%22verdict%3A%20not%20valid%22)%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%7D\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">\u002F\u002F Voucher.java\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> class\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> Voucher\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> static\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> void\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> main\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">String\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">[] \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">args\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        String line \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"INVA-2027,ok\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        String code \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> line.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">split\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\",\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)[\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">];\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"code: \"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> +\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> code);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (code.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">equals\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"INVA-2026\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"verdict: valid\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        } \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">else\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            System.out.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">println\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"verdict: not valid\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\u003Cdiv class=\"code-block-wrapper code-output my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden text-[#e1e4e8] transition-all\" data-output-block>\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"code-output-mark\" aria-hidden=\"true\">&gt;_\u003C\u002Fspan>\n      \u003Cspan class=\"ml-1 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">Output\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20javac%20Voucher.java%20%26%26%20java%20Voucher%20%7C%20java%20CheckVoucher%0AFAIL%20%20line%201%3A%20expected%20code%3A%20INVA-2026%2C%20got%20code%3A%20INVA-2027%0AFAIL%20%20line%202%3A%20expected%20verdict%3A%20valid%2C%20got%20verdict%3A%20not%20valid%0A%0A0%20of%202%20checks%20passed\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>\u003Cspan class=\"code-output-cmd\">$ javac Voucher.java &amp;&amp; java Voucher | java CheckVoucher\u003C\u002Fspan>\nFAIL  line 1: expected code: INVA-2026, got code: INVA-2027\nFAIL  line 2: expected verdict: valid, got verdict: not valid\n\n0 of 2 checks passed\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>Both lines fail and the exit status is 1, because the checker still expects \u003Ccode>INVA-2026\u003C\u002Fcode> and reports the difference on line 1.\u003C\u002Fp>\n\u003Cp>Compare strings with \u003Ccode>.equals()\u003C\u002Fcode>, and use a small checker to verify the output rather than scanning it by eye.\u003C\u002Fp>\n","\u003Cul>\n\u003Cli>\u003Ccode>==\u003C\u002Fcode> on a \u003Ccode>String\u003C\u002Fcode> asks whether two variables hold the same object; \u003Ccode>.equals()\u003C\u002Fcode> asks whether two texts are the same.\u003C\u002Fli>\n\u003Cli>A \u003Ccode>String\u003C\u002Fcode> built at run time, by \u003Ccode>split\u003C\u002Fcode> or by \u003Ccode>new String\u003C\u002Fcode>, is never the same object as the literal it matches.\u003C\u002Fli>\n\u003Cli>\u003Ccode>boolean\u003C\u002Fcode> takes only \u003Ccode>true\u003C\u002Fcode> and \u003Ccode>false\u003C\u002Fcode>, and Java refuses to convert a number into it.\u003C\u002Fli>\n\u003Cli>\u003Ccode>if (passed = true)\u003C\u002Fcode> is an assignment that compiles and is always true.\u003C\u002Fli>\n\u003Cli>\u003Ccode>char\u003C\u002Fcode> is a 16-bit number in quotes: \u003Ccode>&#39;a&#39; + &#39;b&#39;\u003C\u002Fcode> is 195, and \u003Ccode>&#39;7&#39; - &#39;0&#39;\u003C\u002Fcode> is 7.\u003C\u002Fli>\n\u003Cli>A checker that compares the program&#39;s output with the expected answer catches the wrong verdict that the run itself reports as fine.\u003C\u002Fli>\n\u003C\u002Ful>\n",[193,211,231,250,267,287],{"id":194,"title":195,"title_id":196,"slug":197,"excerpt":198,"excerpt_id":199,"has_translation":12,"published_at":200,"reading_time":84,"hidden_from_listing":15,"tags":201,"thumbnail_image":21,"og_image":205,"series":206,"authors":208},164,"Python Capstone: Why a Blank CSV Field Cut the Class Average","Python Capstone: Kenapa Satu Kolom CSV Kosong Memotong Rata-rata Kelas","python-capstone-gradebook","A gradebook reads four students and writes a JSON report. The class average says 52.42, because two empty fields became zeros.","Buku nilai membaca empat siswa dan menulis laporan JSON. Rata-rata kelasnya bilang 52.42, karena dua kolom kosong berubah jadi nol.","2026-11-21T01:00:00.000Z",[202,203,204],"python","input-output","cli","\u002Fog\u002Fpython-capstone-gradebook.png",{"id":207,"title":55,"title_id":56,"slug":57},10,[209],{"authors_id":210},{"id":114,"name":115,"slug":116,"role":117,"profile_picture":21},{"id":212,"title":213,"title_id":214,"slug":215,"excerpt":216,"excerpt_id":217,"has_translation":12,"published_at":200,"reading_time":142,"hidden_from_listing":15,"tags":218,"thumbnail_image":21,"og_image":222,"series":223,"authors":228},48,"What a Linked List Actually Is","Tentang Struktur Data LinkedList","tentang-struktur-data-linked-list","A linked list is a linear chain of nodes, each holding data and a pointer to the next node. Here is what that chain looks like, what it costs next to an array, and the same minimal implementation in Java, Python, and JavaScript.","Linked list adalah rantai linear berisi node, dan setiap node menyimpan data plus pointer ke node berikutnya. Ini bentuk rantainya, ongkosnya dibanding array, dan implementasi paling sederhana dalam Java, Python, serta JavaScript.",[219,220,221,107],"struktur-data","linked-list","pointer","\u002Fog\u002Ftentang-struktur-data-linked-list.png",{"id":224,"title":225,"title_id":226,"slug":227},28,"Linear Data Structures","Struktur Data Linear","asd-struktur-linear",[229],{"authors_id":230},{"id":114,"name":115,"slug":116,"role":117,"profile_picture":21},{"id":232,"title":233,"title_id":234,"slug":235,"excerpt":236,"excerpt_id":237,"has_translation":12,"published_at":238,"reading_time":126,"hidden_from_listing":15,"tags":239,"thumbnail_image":21,"og_image":244,"series":245,"authors":247},163,"Pascal Capstone: Why Every Gradebook Score Came Back Zero","Capstone Pascal: Kenapa Semua Skor Buku Nilai Kembali Nol","pascal-gradebook-capstone","A gradebook reads three students from a file, prints three rows, and every score is 0. The procedure filled a copy of the array, because the parameter was missing `var`. Add the word and the report matches the file; the compiler had already warned about the call that filled nothing.","Sebuah buku nilai membaca tiga siswa dari berkas, mencetak tiga baris, dan setiap skornya 0. Prosedurnya mengisi salinan array, karena parameternya kehilangan `var`. Tambahkan kata itu dan laporannya cocok dengan berkasnya; kompilator sudah memperingatkan soal pemanggilan yang tidak mengisi apa pun.","2026-11-20T01:00:00.000Z",[240,241,242,243],"pascal","record","array","prosedur","\u002Fog\u002Fpascal-gradebook-capstone.png",{"id":246,"title":67,"title_id":68,"slug":69},14,[248],{"authors_id":249},{"id":114,"name":115,"slug":116,"role":117,"profile_picture":21},{"id":251,"title":252,"title_id":253,"slug":254,"excerpt":255,"excerpt_id":256,"has_translation":12,"published_at":238,"reading_time":126,"hidden_from_listing":15,"tags":257,"thumbnail_image":21,"og_image":258,"series":259,"authors":264},162,"Python File I\u002FO: Why the Second Read Came Back Empty","Python File I\u002FO: Kenapa Pembacaan Kedua Kembali Kosong","python-file-read-write","A notes script saves a line, prints it back, then counts zero. The file on disk is correct: `read()` left the pointer at the end, so the second call returned an empty string. Read once into a variable, or `seek(0)`, and the count matches the file.","Skrip catatan menyimpan satu baris, mencetaknya kembali, lalu menghitung nol. Berkas di disk sudah benar: `read()` meninggalkan pointer di ujung, jadi panggilan kedua mengembalikan string kosong. Baca sekali ke sebuah variabel, atau `seek(0)`, dan hitungannya cocok dengan berkas.",[202,203],"\u002Fog\u002Fpython-file-read-write.png",{"id":260,"title":261,"title_id":262,"slug":263},18,"Working with Python Scripts","Menggunakan Script Python","python-pemrograman-dengan-script",[265],{"authors_id":266},{"id":114,"name":115,"slug":116,"role":117,"profile_picture":21},{"id":268,"title":269,"title_id":270,"slug":271,"excerpt":272,"excerpt_id":273,"has_translation":12,"published_at":274,"reading_time":275,"hidden_from_listing":15,"tags":276,"thumbnail_image":21,"og_image":278,"series":279,"authors":284},47,"Why Understanding Algorithms and Data Structures Actually Matters","Pentingnya Memahami Algoritma dan Struktur Data","pentingnya-memahami-algoritma-dan-struktur-data","An algorithm is an ordered list of steps, and that order decides how expensive a problem is. The examples are on the back of an instant noodle packet, in a factorial, and behind ctrl+z.","Sebagai konsep fundamental, algoritma menentukan seberapa mahal sebuah masalah diselesaikan. Contohnya ada di bungkus mie instan, di bilangan faktorial, dan di tombol undo.","2026-11-19T01:00:00.000Z",7,[277,219,107,108],"algoritma","\u002Fog\u002Fpentingnya-memahami-algoritma-dan-struktur-data.png",{"id":280,"title":281,"title_id":282,"slug":283},27,"About Algorithms and Data Structures","Tentang Algoritma dan Struktur Data","asd-intro",[285],{"authors_id":286},{"id":114,"name":115,"slug":116,"role":117,"profile_picture":21},{"id":288,"title":289,"title_id":290,"slug":291,"excerpt":292,"excerpt_id":293,"has_translation":12,"published_at":83,"reading_time":275,"hidden_from_listing":15,"tags":294,"thumbnail_image":21,"og_image":296,"series":297,"authors":298},161,"Debugging Free Pascal with -gl and gdb","Men-debug Free Pascal dengan -gl dan gdb","pascal-debugging-fpc-gdb","A run with no prices ends at a hex address and status 217. `-gl` names the line, gdb names the values, and the mean of six positive prices comes out negative because `integer` is 2 bytes.","Jalan tanpa satu harga pun berakhir di alamat hex dan status 217. `-gl` menyebut barisnya, gdb menyebut nilainya, dan rata-rata dari enam harga positif keluar negatif karena `integer` berukuran 2 byte.",[240,295],"debugging","\u002Fog\u002Fpascal-debugging-fpc-gdb.png",{"id":246,"title":67,"title_id":68,"slug":69},[299],{"authors_id":300},{"id":114,"name":115,"slug":116,"role":117,"profile_picture":21},[302,306,309,312,315,318],{"text":303,"depth":304,"id":305},"Two values, no numbers",2,"two-values-no-numbers",{"text":307,"depth":304,"id":308},"char is a 16-bit integer","char-is-a-16-bit-integer",{"text":310,"depth":304,"id":311},"A String is not the text","a-string-is-not-the-text",{"text":313,"depth":304,"id":314},"A check you can run","a-check-you-can-run",{"text":316,"depth":304,"id":317},"Ask about the text, not the object","ask-about-the-text-not-the-object",{"text":319,"depth":304,"id":320},"The checker is a second reader","the-checker-is-a-second-reader",1795825297326]