Skip to content

Instantly share code, notes, and snippets.

@stevenleelawson
Forked from w3cj/PalindromeTester.java
Created August 29, 2016 15:17
Show Gist options
  • Save stevenleelawson/5b1939e808a999301f72e9cd28350994 to your computer and use it in GitHub Desktop.
Save stevenleelawson/5b1939e808a999301f72e9cd28350994 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