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

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -