class Text3
{
public static void main(String[] args)
{
String str = "abcdefgfedcba";
cmp();
}
public static void cmp()
{
boolean result = true;
int count =(str.length()-1)/2;
for (int x=0;x<count ;x++ )
{
if(str.charAt(x)!=str.charAt(str.length()-1-x))
result = false;
}
if(result)
System.out.println("该字符串是不对称的");
else
System.out.println("该字符串是对称的");
}
public static void cmp(String str)
{
boolean result = true;
int count =(str.length()-1)/2;
for (int x=0;x<=count;x++ )
{
if(str.charAt(x)!=str.charAt(str.length()-1-x)){
result = false;
break;
}
}
if(!result)
System.out.println("该字符串是不对称的");
else
System.out.println("该字符串是对称的");