1个回答
2013-11-13
展开全部
import java.io.*;
public class HuiWen {
String reverse(String w1) {
String w2;
char []str1 = w1.toCharArray();
int len = w1.length();
char []str2 = new char[len];
for(int i = 0; i<len; i++) {
str2[i] = str1[len - 1 -i];
}
w2 = new String(str2);
return w2;
}
public static void main(String args[]) {
HuiWen hw1 = new HuiWen();
String pm ="";
try {
InputStreamReader Reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(Reader);
System.out.print("give your test String :\n");
pm = input.readLine();
}catch(IOException e) {
System.out.println("exception occur..");
}
String w2 = hw1.reverse(pm);
if(w2.compareTo(pm) == 0) {
System.out.println("It is a HuiWen");
}
else {
System.out.println("It is not a HuiWen");
}
}
}
public class HuiWen {
String reverse(String w1) {
String w2;
char []str1 = w1.toCharArray();
int len = w1.length();
char []str2 = new char[len];
for(int i = 0; i<len; i++) {
str2[i] = str1[len - 1 -i];
}
w2 = new String(str2);
return w2;
}
public static void main(String args[]) {
HuiWen hw1 = new HuiWen();
String pm ="";
try {
InputStreamReader Reader = new InputStreamReader(System.in);
BufferedReader input = new BufferedReader(Reader);
System.out.print("give your test String :\n");
pm = input.readLine();
}catch(IOException e) {
System.out.println("exception occur..");
}
String w2 = hw1.reverse(pm);
if(w2.compareTo(pm) == 0) {
System.out.println("It is a HuiWen");
}
else {
System.out.println("It is not a HuiWen");
}
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询