JavaScript is required to use Bungie.net

Tema libero

Naviga in una tempesta di discussioni disparate.
3/20/2013 4:48:03 AM
12

This is why Java sucks

[quote]byte[] buff = new byte[]{'H', 'e', 'l', 'l', 'o'}; String str1 = new String(buff); String str2 = "Hello"; if(str1 == "Hello"){ System.out.println("Every good programming language"); } else if(str1 == str2){ System.out.println("lolwut?"); } else{ System.out.println("Java " + (str1.equals("Hello") ? "sucks" : "doesn't suck")); }[/quote] Output:[quote]Java sucks[/quote]

Lingua:

 

Fate i bravi. Prima di postare date un'occhiata al nostro codice di condotta. Annulla Modifica Crea squadra Invia

Visualizza l'intera discussione
  • I'm not too sure why you'd compare strings on reference rather than value. Anywho, I've long since passed the stage where I bother questioning the strange goings on in the land of programming. It's almost as if the people who design programming languages are all just massive trolls who delight in causing pain and suffering to others.

    Lingua:

     

    Fate i bravi. Prima di postare date un'occhiata al nostro codice di condotta. Annulla Modifica Crea squadra Invia

Non ti è permesso visualizzare questo contenuto.
;
preload icon
preload icon
preload icon