This is my new blog section, titled I Hate Java. In this section, I will point out why Java sucks hard, and why Sun sucks for making Java really awkward and separate from the many other languages in the world.
For today's entry, I chose String pointers. Take this code, for example.
As you can tell, both variables bull and shit have the same contents. If you were to run a line like:
Then, you'd get isEqualTo to be true. Then, if you look at shouldNotBeEqualTo, you should get false. BUT YOU DON'T. You get true!!!! What the hell?
As it turns out, for Java purposes, if Java detects that you create two strings using the shorthand, where your value is enclosed in quotation marks, it notices that the two are the same string, and as such, actually does something so stupid as to point them at the same address in memory.
I hate Java.