Re: String question



Lew wrote:
Lasse Reichstein Nielsen wrote:
(In this particular case it'll probably just concatenate the two
literal strings at compile time, though).

It has to, by JLS 15.28, "Constant Expression".
<http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#5313>.

It could generate

String s = "Hello" + :"World";

as

String s = ("Hello".concat("World")).intern();

That would be really silly, but not so far as I can see illegal.


.



Relevant Pages

  • Re: Restoring Swing applications after minimising
    ... Lew is actually using a lot of logical fallacies in various ... As soon as he cannot quote the JLS he's lost. ... Java is the holy grail and the JLS is the gospel. ...
    (comp.lang.java.programmer)
  • Re: Compile time string literal substitution to external data file
    ... > literal strings, and then building a tool to strip the strings from the ... > binary at compile time. ... I noticed one community member has posted a response to the ...
    (microsoft.public.vc.language)
  • Re: Why is dynamic polymorphism so useful?
    ... Lew wrote: ... including in code that is not available at compile time. ... The "pseudo" in "pseudorandom" isn't supposed to mean, "deterministic, decided before we even deploy the program". ... cryptography - java.security.SecureRandom exist to handle those ...
    (comp.lang.java.programmer)
  • Re: is assignment atomic/thread safe?
    ... Lew wrote: ... Of course, that link directs one to the JLS 3rd edition for clarification of the issues discussed in this thread, and to which we have been referring anyway, so no harm done. ...
    (comp.lang.java.programmer)
  • Re: Which is more efficient?
    ... > BufferedWriter bw = new BufferedWriter(new ... > because literal strings are concatenated at compile time. ... Qingjia Zhu ...
    (comp.lang.java.programmer)