Register for your free account! | Forgot your password?

You last visited: Today at 16:23

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Java

Discussion on Java within the Java forum part of the Coders Den category.

Reply
 
Old 09/24/2015, 19:31   #16
 
elite*gold: 0
Join Date: May 2015
Posts: 700
Received Thanks: 445
Ich habe es gerade ausprobiert: Hieran optimiert der Compiler nichts, also das "new String()" steht auch noch im Bytecode:
Code:
public class test
{
  public String meh()
  {
    String str = new String();
    str = "Hello World";
    return str;
  }
}
(Ich habe das mit javac compiled und anschließend mit JD-GUI decompiled)

Das selbe ist das auch nicht: new String() legt immer ein neues Objekt an, während "" den leeren String höchstens einmal anlegt, und dann immer wieder das selbe Objekte verwendet. Deswegen liefert auf die Bedingung
Code:
"abc" == "abc" && "" == "" && new String("") != new String("")
wahr, obwohl nicht mit equals() verglichen wird.
algernong is offline  
Reply


Similar Threads Similar Threads
[JAVA Error] Could not create the java virtual machine
07/21/2013 - Technical Support - 10 Replies
Schönen Abend! Leider hat es sich aus einem unerfindlichen Grund ergeben, dass sobald ich die Minecraft.exe starten will die Errormeldung kommt. Die Tips auf Minecraft.net habe ich schon ohne Erfolg befolgt. Hoffe ihr könnt mir weiterhelfen... Mein PC:
recompile Problem (Block.java, item.java)
04/13/2013 - Minecraft - 1 Replies
Guten Morgen liebe Com (: Ich versuche etwas neues in Minecraft.. für mich einzubauen.. neuer Block + das Item dazu, des eingepflanzt werden muss.. wie bei einer Karotte oder einer Kartoffel. Ich zeige euch den Inhalt meiner BlockOnion.java package net.minecraft.src;



All times are GMT +2. The time now is 16:23.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.