Top 10 useful, yet paranoid Java programming techniques
The Insider News
3
Posts
3
Posters
0
Views
1
Watching
-
-
// Bad
if (variable.equals("literal")) { ... }// Good
if ("literal".equals(variable)) { ... }IMO code like this hides real bugs, I'd much rather get a null exception and figure out why the variable is NULL instead of been fooled into thinking evreything is working because it didn't crash.
-
// Bad
if (variable.equals("literal")) { ... }// Good
if ("literal".equals(variable)) { ... }IMO code like this hides real bugs, I'd much rather get a null exception and figure out why the variable is NULL instead of been fooled into thinking evreything is working because it didn't crash.
... You can do that?! Why is that even a thing?