什么实际上双等于运营商在这里..?

时间:2014-09-17 15:22:03

标签: java palindrome

// Program to check a string is palindrome or or not

class Pal

{

static void pal(String k)

{
int flag=0;

int x;

char ch[]= k.toCharArray();

char p[]=k.toCharArray();

x=k.length()-1;

for(int i=0;i<k.length();x--,i++)

{

p[i]=ch[x];

}

System.out.println(p);

System.out.println(ch);

    if(p==ch)
    {
    System.out.println("palindrome String");
    }
    else
    {
    System.out.println("Not a palindrome string");
    }

}
public static void main(String... s)
{

String g="aba";

//String s1=g.toUpperCase();

System.out.println("input string is "+g);

pal(g);

}

}

/* Error:
output is :
input string is aba
aba
aba
Not a palindrome string
*/

0 个答案:

没有答案