大部分代码跟我所想差不多。不过对为什么使用循环不理解,个人的话,会把
for(int i = 0; i < 2; i ++){
br_key = new BufferedReader(new InputStreamReader(System.in));
if(i == 0){
System.out.println("Please enter the first string:");
str_One = br_key.readLine();
}else if(i == 1){
System.out.println("Please enter the second string:");
str_Two = br_key.readLine();
}
}
这十行代码(不含空行)变成五行:
br_key = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please enter the first string:");
str_One = br_key.readLine();
System.out.println("Please enter the second string:");
str_Two = br_key.readLine();
另外,类名不习惯小写打头。
[
本帖最后由 洛云 于 2011-7-2 11:29 编辑 ]