蓝桥网试题 java 基础练习 字符串对比

--------------------------------------------------------------------------------

java有很多可以拿来用的方法为什么不用呢

--------------------------------------------------------------------------------

 1 import java.util.*;
 2 public class Main {
 3     public static void main(String[] args) {
 4         Scanner sc = new Scanner(System.in);
 5         String a1 = sc.nextLine();
 6         String a2 = sc.nextLine();
 7         if(a1.length()==a2.length())
 8             if(a1.toLowerCase().equals(a2.toLowerCase()))
 9                 if(a1.equals(a2))
10                     System.out.println(2);
11                 else
12                     System.out.println(3);
13             else
14                 System.out.println(4);
15         else
16             System.out.println(1);
17     }
18 }

 

 

 

 

 

原文地址:https://www.cnblogs.com/loveluking/p/6076884.html