Learning how to write java by creating a class that detects palindromes