On Tue, Jul 24, 2012 at 12:00 AM, Drake <[email protected]> wrote:
> I like that you use +'s to concat strings, it shows a real lack of
> experience doing optimizations since that is the very first thing on every
> list.
>
>> System.out.println(new Date() + ":" + new
> Random().nextInt());
You're either trolling me or have yet another wild misconception about
Java. This one is really easy to disprove though:
--- Stringy.java ---
public class Stringy {
public static void main(String[] args) {
String foo = "def";
System.out.println("abc" + foo);
}
}
$ javac Stringy.java
$ javap -c Stringy
Compiled from "Stringy.java"
public class Stringy extends java.lang.Object{
public Stringy();
Code:
0: aload_0
1: invokespecial #1; //Method java/lang/Object."<init>":()V
4: return
public static void main(java.lang.String[]);
Code:
0: ldc #2; //String def
2: astore_1
3: getstatic #3; //Field java/lang/System.out:Ljava/io/PrintStream;
6: new #4; //class java/lang/StringBuilder
9: dup
10: invokespecial #5; //Method java/lang/StringBuilder."<init>":()V
13: ldc #6; //String abc
15: invokevirtual #7; //Method
java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
18: aload_1
19: invokevirtual #7; //Method
java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
22: invokevirtual #8; //Method
java/lang/StringBuilder.toString:()Ljava/lang/String;
25: invokevirtual #9; //Method
java/io/PrintStream.println:(Ljava/lang/String;)V
28: return
}
I'm pretty sure you can read that.
Jeff
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.