classpath
[Top][All Lists]
Advanced

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

RE: String.equals optimisation


From: Jeroen Frijters
Subject: RE: String.equals optimisation
Date: Tue, 12 Jul 2005 09:10:05 +0200

Archie Cobbs wrote:
> Simon Kitching wrote:.
> > * Class.getName returns strings that have been interned. I don't
> >   think this is explicitly required by the java specs but is
> >   certainly true for Sun's JVM and seems likely to be done by
> >   any sensible JVM.
> 
> I.e., is there something special about class names which means
> they should be treated differently from any other String randomly
> created and used in a Java application? (rhetorical question)
> Otherwise, why not intern all Strings? Etc.
> 
> In any case, to provide two concrete counter-examples:
> 
>    $ cat > zz.java
>    public class zz {
>      public static void main(String[] args) {
>          zz z = new zz();
>          System.out.println(z.getClass().getName() == "zz");
>      }
>    }
>    $ javac zz.java
>    $ java zz
>    true
>    $ jc -Xint zz
>    false
>    $ jamvm zz
>    false

$ ikvm zz
true

He did say "any sensible JVM"... <gd&r>

Regards,
Jeroen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]