ackage com.javadb.examples;
public class Main {
public static void main(String[] args) {
String s1 = new String("abc");
String s2 = new String("abc");
if (s1 == s2) {
System.out.println("s1 == s2");
}
if (s1.equals(s2)) {
System.out.println("s1.equals(s2)");
}
if (s1.compareTo(s2) == 0) {
System.out.println("s1.compareTo(s2) == 0");
}
}
}
public class Main {
public static void main(String[] args) {
String s1 = new String("abc");
String s2 = new String("abc");
if (s1 == s2) {
System.out.println("s1 == s2");
}
if (s1.equals(s2)) {
System.out.println("s1.equals(s2)");
}
if (s1.compareTo(s2) == 0) {
System.out.println("s1.compareTo(s2) == 0");
}
}
}
Search News
News Categories
What's the News?
Post a link to something interesting from another site, or submit your own original writing for the Java community to read.
Most Popular News
-
How to stand out from other Java/JEE Professionals?
Published about 14-01-2009 | Rated +3 -
10 reasons IT certification will be important in 2009
Published about 05-01-2009 | Rated +2 -
The 9 hottest skills for `09
Published about 02-01-2009 | Rated +1 -
New Features in Servlets 3.0
Published about 05-01-2009 | Rated +4
Most Recent User Submitted News
- SCWCD FAQ
Published about 09-01-2009 | Rated +2 - Agile testing: a whole life-cycle approach
Published about 19-06-2009 | Rated 0 - Regular Expressions in Java
Published about 19-10-2009 | Rated 0 - Java SE 7 OCA Training Lab
Submitted by Treacy | Rated +1







