compare to Java code example
Example 1: string compare java ==
new String("test").equals("test")
new String("test") == "test"
new String("test") == new String("test")
Example 2: string compare java
new String("test").equals("test")
new String("test") == "test"
new String("test") == new String("test")
Example 3: compareto method java
public int compareTo(Jedi jedi){
return this.age > jedi.age ? 1 : this.age < jedi.age ? -1 : 0;
}
Example 4: lexicographically greater string java
s1.compareTo(s4)
Example 5: compare to java
String myStr1 = "Hello";
String myStr2 = "Hello";
System.out.println(myStr1.compareTo(myStr2));