E
Edward A Thompson
Is the A) and less efficiecnt than B)? Should I be using
StringBuffers instead?
String value23 = "23";
A:
String a = "line 1:" + "twenty three = " + value23 ;
B:
String = "line 1:twenty three = " + value23 ;
I m using something like A) for readability when the Strings I am
assigning are long so that the program is readable (for instance,
building a lon SQL statement), but I don't want to imapct actual
performance. I know String buffers are better for dynamic Strings,
but wasn't sure how the compiler would respond to the above, IE are
the additions in the string assignment accomplished at run time or
compile time?
If at run time, won't each addition dictate and actaulareallocation of
the String? If compile time, won't it be smart enough to only
allocate once?
Feedback appreciated before I get to farther in right/wrong design...
StringBuffers instead?
String value23 = "23";
A:
String a = "line 1:" + "twenty three = " + value23 ;
B:
String = "line 1:twenty three = " + value23 ;
I m using something like A) for readability when the Strings I am
assigning are long so that the program is readable (for instance,
building a lon SQL statement), but I don't want to imapct actual
performance. I know String buffers are better for dynamic Strings,
but wasn't sure how the compiler would respond to the above, IE are
the additions in the string assignment accomplished at run time or
compile time?
If at run time, won't each addition dictate and actaulareallocation of
the String? If compile time, won't it be smart enough to only
allocate once?
Feedback appreciated before I get to farther in right/wrong design...