On Tue, 2002-01-29 at 07:52, E.L. Willighagen wrote: > > Hi all, > > can anyone tell me the difference (performance etc) between: > > 1. String someString = "text" > if ("some text".equals(someString)) {}; > > and > > 2. String someString = "text" > if (someString.equals("some text")) {};
Performance will be the same, but (1) is safer is someString could ever be null, as a NullPointerException will not be throw. Ross -- Ross Burton mail: [EMAIL PROTECTED] jabber: [EMAIL PROTECTED] PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]