<div dir="ltr"><div dir="ltr">On Thu, Oct 26, 2023 at 5:21 AM tzengshinfu <<a href="mailto:tzengshinfu@gmail.com">tzengshinfu@gmail.com</a>> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I've noticed that `string comparison` in Java can be confusing ...<br></div></blockquote><div><br></div>This idea strikes me as misguided.</div><div class="gmail_quote"><br></div><div class="gmail_quote">What you're saying does make sense - IF you are looking at Java from the perspective of another programming language where strings have a special, unique type defined in the language itself. For example, Javascript, which has "boolean", "number", "string", "object", etc.</div><div class="gmail_quote"><br></div><div class="gmail_quote">But for this discussion, try to break out of that mindset.</div><div class="gmail_quote"><br></div><div class="gmail_quote">What you're missing is that Java was designed based on different design principles. Let's go back in history for a moment...<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">The design of Java was in part an anti-complexity reaction to the overly complex design of C++. And Java became wildly successful as a result.<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">This is totally analogous to how Unix was an anti-complexity reaction to the overly complex design of Multics. And Unix became wildly successful as a result.</div><div class="gmail_quote"><br></div><div class="gmail_quote">In Java, you have 8 primitive types and Object. That's it! Everything that can contain state is one of those types. If you can understand 9 things, you can understand everything.<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">In Unix all system resources are expressed as files, including block devices, serial ports, etc. If you know how to open and read a file, you know how to work with all of those system resources. One and done!<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">In Javascript, if you want a string, you use the "string" type of the language. In Java, you use the class "java.lang.String" which is a normal class just like any other.</div><div class="gmail_quote"><br></div><div class="gmail_quote">In Javascript, if you want a map, you use the "object" type of the language. In Java, you use "java.util.HashMap", or "java.util.TreeMap", or whatever. Again, these are normal classes just like any other.</div><div class="gmail_quote"><br></div><div class="gmail_quote">So to change how String behaves would be to introduce a 10th "thing" into the language... No thanks!!<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">-Archie<br></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div>