Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static boolean PalindromeWord(String word) {
- char[] ch=word.toCharArray();
- int i=0,j=word.length()-1;
- boolean check=false;
- while(i<j) {
- if(ch[i] == ch[j]) check=true;
- else check=false;
- i++;
- j--;
- }
- return check;
- }
- public static void main(String[] args) {
- String word="haah";
- System.out.println(PalindromeWord(word));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement