Created
August 7, 2019 16:47
-
-
Save parzibyte/3bff7877dcce8ca96ff307a4fe4cc81c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Probar igualdad de cadenas usando Java | |
parzibyte.me/blog | |
*/ | |
class Main { | |
public static void main(String[] args) { | |
// Dos cadenas que tienen el mismo contenido. | |
// Deberían ser iguales, ¿verdad? | |
String unaCadena = new String("Hola"); | |
String otraCadena = new String("Hola"); | |
// Vamos a comprobarlo: | |
if(unaCadena == otraCadena){ | |
System.out.println("Las cadenas son iguales :-)"); | |
}else{ | |
System.out.println("Las cadenas no son iguales :("); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment