Skip to content

Instantly share code, notes, and snippets.

@w3cj
Last active August 15, 2022 23:03
Show Gist options
  • Save w3cj/14c22ac9ac4daac77c904e4254181982 to your computer and use it in GitHub Desktop.
Save w3cj/14c22ac9ac4daac77c904e4254181982 to your computer and use it in GitHub Desktop.
// run from the command line with:
// javac PalindromeTester.java && java PalindromeTester
public class PalindromeTester {
public boolean isPalindrome(String input) {
// your code here
return false;
}
public static void main(String[] args) {
printTestPalindrome("race car"); //true
printTestPalindrome("wat"); //false
printTestPalindrome("stack cats"); //true
printTestPalindrome("who"); //false
printTestPalindrome("step on no pets"); //true
printTestPalindrome("when"); //false
printTestPalindrome("taco cat"); //true
}
public static void printTestPalindrome(String input) {
PalindromeTester tester = new PalindromeTester();
System.out.println(input + ": " + tester.isPalindrome(input)); //true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment