Skip to content

Instantly share code, notes, and snippets.

@RayKoren
Forked from w3cj/PalindromeTester.java
Created August 29, 2016 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RayKoren/393d25447d34201cc8f3caf52f4cd597 to your computer and use it in GitHub Desktop.
Save RayKoren/393d25447d34201cc8f3caf52f4cd597 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