*
I have provided a Selenium and Java program below to validate whether a given string is a palindrome. You can review the program and share your comments about its output. Click the “Click for Solution” button below to view the explanation.
import org.testng.annotations.Test;
public class SampleProgram8 {
@Test
public void testMySkills() {
String str = "Test My Skill";
if(checkPalindrome(str)){
System.out.println("'"+str+"'"+" "+" is palindrome");
}
else{
System.out.println("'"+str+"'"+" "+" is not palindrome");
}
}
public Boolean checkPalindrome(String str) {
int len = str.length();
int start = 0;
int end = len-1;
while(start<=end) {
if(str.charAt(start) != str.charAt(end)){
return false;
}
start++;
end--;
}
return true;
}
}