package Lect25Callstack; public class Test { public boolean isPalindrome(String theStr) { StringBuffer strBuffer = new StringBuffer(theStr); String reversed = strBuffer.reverse().toString(); if (reversed.equals(theStr)) { return true; } else { return false; } } public Test() { String word = new String("racecar"); if (isPalindrome(word)) { System.out.println(word + " is a palindrome."); } else { System.out.println(word + " is not a palindrome."); } } public static void main(String[] args) { Test test = new Test(); } }