No — that is one of the advantages of using StringBuffer.
A palindrome is a string that reads the same when it is reversed. Punctuation, spaces, and capitalization are ignored. For example the following is a palindrome:
A man, a plan, a canal, Panama!
Let us write a program that determines if its command line argument is a palindrome:
C:\Notes/chap49D>java PalindromeTester "A man, a plan, a canal, Panama!" Is a Palindrome
Here is a skeleton of the program:
class Tester
{
public boolean test( String trial )
{
. . . .
}
}
public class PalindromeTester
{
public static void main ( String[] args )
{
if ( args.length == 0 )
{
System.out.println( "usage: java Palindrome \"Trial String\" " );
return;
}
Tester pTester = new Tester();
if ( pTester.test( args[0] ) )
System.out.println( "Is a Palindrome" );
else
System.out.println( "Not a Palindrome" );
}
}