Thread: simple code
View Single Post
  #1 (permalink)  
Old 08-07-2007, 08:45 PM
elizabeth elizabeth is offline
Member
 
Join Date: Jul 2007
Posts: 40
elizabeth is on a distinguished road
simple code
The following function determine if its parameter is a string which reads exactly the same forward or backward. There is an error in the code.

Code:
boolean isPalindrome(String s) { int i=0, j = s.length( ) -1; while ( i !=j && s.charAt(i)==s.charAt(j)) { i++; j--; } return (i==j); }
help please
Reply With Quote
Sponsored Links