Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Advanced-java] Odd question


  • From: lnadai@xxxxxxxxx (laszlo)
  • Subject: [Advanced-java] Odd question
  • Date: Thu, 28 Mar 2002 18:14:51 -0800

Hi Alvin,

String str = new String("abc");
System.out.println(str.intern() == "abc");    //is true
There is a short article about that (if you don't want to read the JLS :-)
at:
http://developer.java.sun.com/developer/TechTips/1999/tt0114.html#tip3

laszlo


Alvin Wang wrote:

> Hi! It is a little odd. Let us say:
>
> String str = new String("abc");
>
> We all know that (str == "abc") is false. My question is how to manipulate
> str to make str point to "abc" (because str knows that its value itself is
> "abc"), or in the other word, to make (str == "abc") true?
>
> Thanks!
>
> _______________________________________________
> Advanced-java mailing list
> Advanced-java@xxxxxxxxxxxxxxxxxxxxxx
> http://lists.xcf.berkeley.edu/mailman/listinfo/advanced-java