Help getting experience

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Shawn Rutledge
Date:  
New-Topics: OT: Language Stuff (WAS: Help getting experience)
Subject: Help getting experience
On Fri, Jun 21, 2002 at 11:09:44AM -0700, Isaac Sparrow wrote:
> String a = "foo"
> String b = "foo"
>
> if (a.equals(b))    // true

>
> if (a == b)    // false


Maybe, but Java can also do string interning, which means that it will
see that you already have "foo", probably don't need another one, and
therefore make them both refer to the same instance. While in general
you should use .equals() (or .equalsIgnoreCase(), also very handy; or a
Collator, for faster comparison of frequently-used strings, or for
alphabetical sorting) to compare strings, if you use intern() on every
String, you can use == to compare them, and it will be a lot faster to
just compare references instead of looking at every character until a
difference is found. But internment (like interrment!) is itself an
expensive operation.

Make sure you know the difference between deprecation and depreciation,
and how to pronounce the two; hate to think of how many programmers I've
met who don't.

-- 
  _______                   Shawn T. Rutledge / KB7PWD  
 (_  | |_)                       http://ecloud.org  
 __) | | \________________________________________________________________