Originally Posted by
GregBrannon
String objects are not primitives, though Java allows the programmer to sometimes treat them as if they were.
Some disagree with your affection for the switch() statement. A programmer I respect once said, "The switch() statement is for the lazy and unimaginative." While it's a tool for use, there are often better tools available - a personal choice.
Explain on the "tools" you are referring to? Switch statements make your code far cleaner than and can become a good practice.
Example:
if (obj.getString().equals("blah blah blah)) {}
else if (obj.getString().equals("blah blah blah)) {}
else if (obj.getString().equals("blah blah blah)) {}
else if (obj.getString().equals("blah blah blah)) {}
else if (obj.getString().equals("blah blah blah)) {}
^ Your retrieving the string every time from the var obj, therefore more of a memory heap and more work for the GC. Even though you could create another var that refers to the obj.getString() (String s = obj.getString()), this is what I tend to see in most applications programmed by other intermediate programmers.