java - Check if a string is a Palindrome (using methods) -
i have no idea why following method not working. shows:
palindrome.java:97: error:
<identifier>
expected
the method takes parameter string , should return true
or false
if provided string palindrome.
public static boolean checkpalindrome(checkstring) { boolean test = true; int left = 0; int right = checkstring.length() - 1; while (left < right && test) { if (checkstring.charat(left) != checkstring.charat(right)) { test = false; } right--; left++; } return test; }
mistake in first line , should :
public static boolean checkpalindrome(string checkstring)
you have provide data type before parameter ^
Comments
Post a Comment