
Signature
-Aki "Sus" Laukkanen
"No Akia nyt on niin helppo raadella - senkun vaan raatelee."
On Tue, 21 Sep 2004 11:51:13 +0300, Aki "Sus" Laukkanen
<aki.laukkanenREMOVETHIS@helsinki.fi> wrote:
>> Why not just use
>> private String currentOperation = "deleteGroup()";
>
> Isn't it supposed to be done like this:
>
> private String currentOperation = new String("deleteGroup()");
Why? You can use a String literal in any place you can use a String
Object. After all, the Literal
is nothing but a fancy way of writing an Object. (you could also use
private String currentOperation = new String(new char[]{'d', 'e', 'l',
'e', 't', 'e', 'G', 'r', 'o', 'u', 'p',
'(', ')'}); if you really insist, but this has no advantage over using a
literal.

Signature
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
> private String currentOperation = new String("deleteGroup()");
No, that creates an unnecessary String object. String literals are
String objects on their own.
Aki \ - 21 Sep 2004 10:15 GMT
>>private String currentOperation = new String("deleteGroup()");
>
> No, that creates an unnecessary String object. String literals are
> String objects on their own.
Ah.
Wasn't aware of that. My bad. :)

Signature
-Aki "Sus" Laukkanen