Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
When you finaly learn that, you
are going to have problems with
if( string = "test" )
One problem solved, another created :P -
that took me about 3-6 days to fix. through hours of stackoverflowing someone mentioned to use the .equals method instead and it blew my mind away, why the fuck would someone build that in java
-
@SukMikeHok @Codex404 From what I remember... it has something todo with == being a comparison for object states or something like that, not values and since String is essentially a char array... its not classified as a primitive data type in java. I stand to be corrected though.
-
YADU13966y== compares the objects in Java for non-primitive types. So for two strings, it compares the string objects, which is almost never ehat you want.
FWIW, my IDE complains if i do == on strings. -
@YADU @InterferenceObj I know, but why? If I would do Java I would overwrite the default string to overwrite the operators.
-
@InterferenceObj @Codex404 it probably wasnt intentional... just a side effect of how the comparison for objects/non-primitive data types had to be
Related Rants
I need someone standing behind me 24/7 making sure I don't try to String == "test"
Just wasted half an hour wondering why nothing was happening
rant
time wasted
java
string
==