码迷,mamicode.com
首页 > 其他好文 > 详细

基础练习 字符串对比

时间:2016-11-18 11:53:40      阅读:303      评论:0      收藏:0      [点我收藏+]

标签:static   imp   stat   print   center   image   enter   images   als   

技术分享

技术分享

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

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 }

 

 

 

 

 

 

基础练习 字符串对比

标签:static   imp   stat   print   center   image   enter   images   als   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!