标签:main stream 字母 else buffer 情况 throws int style
beiJing
1 import java.io.BufferedReader; 2 import java.io.IOException; 3 import java.io.InputStreamReader; 4 5 public class Main15 { 6 public static void main(String[] args) throws IOException { 7 BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 8 String str1 = br.readLine(); 9 String str2 = br.readLine(); 10 11 int result = f(str1,str2); 12 System.out.println(result); 13 } 14 15 private static int f(String str1, String str2) { 16 if(str1.length() != str2.length()){ 17 return 1; 18 }else{ 19 if(str1.equals(str2)){ 20 return 2; 21 }else if(str1.equalsIgnoreCase(str2)){ //equalsIgnoreCase--忽略大小写比较字符串是否相等 22 //与str.toUpperCase()或str,toLowerCase()结果相等 23 return 3; 24 }else{ 25 return 4; 26 } 27 } 28 } 29 }
标签:main stream 字母 else buffer 情况 throws int style
原文地址:http://www.cnblogs.com/cao-lei/p/6686130.html