Identify the missed statement in the Code – Selenium with Java challenge 6

We have provided a Selenium with Java program below to check whether the given string is a palindrome. One statement has been intentionally removed from the code. Identify the missing statement required for the palindrome check to work correctly and share your comments. You can view the solution by clicking the Click for Solution button below.

import org.testng.annotations.Test;

public class SampleProgram6 {

@Test
public void testMySkills() {
   String str = "Hello";
   if(checkPolindrome(str)){
    System.out.println(str+" is a polindrome");
   }
   else{
    System.out.println(str+" is not a polindrome");
   }
   
}

public Boolean checkPolindrome(String str) {
    int start = 0;
    int len = str.length();
    int end = len-1;
    while(start<=end) {
        if(str.charAt(start) != str.charAt(end)){
           return false;
        }
        start++;
    }
    return true;
}

}

5 1 vote
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Testingtalkslatest.com - A project by CreativeHub IT Solutions.
Contact Us At: support@testingtalkslatest.com
Our Partner websites - Classified Hub , CodesToolbox , CodesToolbox
Scroll to Top
0
Would love your thoughts, please comment.x
()
x