i was wonder which is what
I was asked in an interview a while ago which is more efficient and i had no clue, just out of curiosity anyone know the difference...
String x = "ben";
"ben".equals(x);
x.equals( "ben" );
which is better? i though they were the same as far as creating new memory and what not. why is one better then the other and would i care if the java VM handles memory management
[399 byte] By [
bens2333a] at [2007-11-27 3:53:46]

For that matter, I'm generally suspicious of any code that does string comparisons, unless it's a sort or a parser. I've seen too much code that hides semantics in naming schemes...
> For that matter, I'm generally suspicious of any code
> that does string comparisons, unless it's a sort or a
> parser. I've seen too much code that hides semantics
> in naming schemes...
Not to mention the over-use of String as a catch-all datatype. "Oh, we've used Strings here to represent the status of the order". Why? Why not have a Status class? etc