Java 比较字符串3


Java 比较字符串3

public class StringCompare3 {

   public static void main(String[] args) {

      String n1  ="Java";  

      String n2 = "Java";  

      String n3 = "Python";  



      System.out.println(n1.compareTo(n2));

      System.out.println(n1.compareTo(n3));  

      System.out.println(n3.compareTo(n1));

   }

}