Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #484

Re: String comparisons

From Roedy Green <see_website@mindprod.com.invalid>
Newsgroups comp.lang.java.help
Subject Re: String comparisons
Date 2011-04-02 21:17 -0700
Organization Canadian Mind Products
Message-ID <4qrfp694220avotb5l7n064ehrouh0v64r@4ax.com> (permalink)
References <87r59kpfgs.fsf@merciadriluca-station.MERCIADRILUCA>

Show all headers | View raw


On Sat, 02 Apr 2011 22:26:27 +0200, Merciadri Luca
<Luca.Merciadri@student.ulg.ac.be> wrote, quoted or indirectly quoted
someone who said :

>String d = new String("abcd");
>String s = new String("abcd");
>String c = d;
>String n = c.clone(); // see discussion here after

new String almost never needed.  Just use "abcd".

You can't  use String.clone because it is a protected method and
String is final. So any speculation about its behaviour is
theological.


See http://mindprod.com/jgloss/gotchas.html
especially the one on string comparison.

See also http://mindprod.com/jgloss/string.html
http://mindprod.com/jgloss/interned.html
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
Doing what the user expects with respect to navigation is absurdly important for user satisfaction.
~ anonymous Google Android developer

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

String comparisons Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-02 22:26 +0200
  Re: String comparisons Aéris <aeris@imirhil.fr> - 2011-04-02 23:23 +0200
    Re: String comparisons Aéris <aeris@imirhil.fr> - 2011-04-02 23:27 +0200
    Re: String comparisons Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 18:59 +0200
      Re: String comparisons Lew <noone@lewscanon.com> - 2011-04-06 12:19 -0400
  Re: String comparisons Roedy Green <see_website@mindprod.com.invalid> - 2011-04-02 21:17 -0700
  Re: String comparisons Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 12:07 +0200

csiph-web