Sridhar
Posts: 3
Nickname: sweetsri
Registered: Oct, 2002
|
|
Re: can some teach me how to do palindrome this is wat i have
|
Posted: Oct 9, 2002 12:05 AM
|
|
Hey the total program is here....
public class Palin { public boolean isPalin(String word) { boolean flag = true; for(int i=0,j=word.length()-1;i<word.length()/2 && flag;i++,j--) { if (word.charAt(i)!=word.charAt(j)) { flag = false; } } return flag; } public static void main(String[] args) { Palin p = new Palin(); if (p.isPalin("Raj")) System.out.println("It is Palindrome...");
else System.out.println("It is not Palindrome..."); } }
|
|