Created
January 21, 2013 11:02
-
-
Save ucheng/4585297 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
public class StringEquals { | |
public static void main(String[] args) { | |
jack(); | |
jill(); | |
jeff(); | |
john(); | |
} | |
public static void jack() { | |
String s1 = "hill5"; | |
String s2 = "hill" + "5"; | |
System.out.println(s1 == s2); | |
} | |
public static void jill() { | |
String s1 = "hill5"; | |
String s2 = "hill" + s1.length(); | |
System.out.println(s1 == s2); | |
} | |
public static void jeff() { | |
String s1 = "hill5"; | |
int i = 5; | |
String s2 = "hill" + i; | |
System.out.println(s1 == s2); | |
} | |
public static void john() { | |
String s1 = "hill5"; | |
String s2 = "hill" + 5; | |
System.out.println(s1 == s2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment