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.

String first = "Java sucks";
String second = "Java sucks";

As you can tell, both variables first and second have the same contents. If you were to run a line like:

boolean isEqualTo = first.equals(second);
boolean shouldNotbeEqualTo = first == seconds;

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???

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.