java_函数手册_String_1.5_compareTo_比较两个字符串
1 package calssString; 2 3 public class compareTo___1_5 { 4 public static void main(String[] args) { 5 String comStr = "I LIKE JAVA"; 6 String comStr1 = "I LIKE PHP"; 7 int strLower = comStr.compareTo(comStr1); 8 System.out.println(strLower); 9 10 comStr = "I LIKE JAVA"; 11 comStr1 = "i like PHP"; 12 strLower = comStr.compareTo(comStr1); 13 System.out.println(strLower); 14 } 15 }