Answer:

The nearly completed method is below.

Near-complete Method

class Tester
{
  public boolean test( String trial )
  {
    String lower = trial.toLowerCase();

    StringBuffer azBuffer  = new StringBuffer();

    for ( int j=0; j < lower.length(); j++ )
    {
       char c = lower.charAt(j);
       if ( c >= 'a' && c <= 'z' )
         azBuffer.append( c );
    }

    String forward  = azBuffer.toString();
    String backward = azBuffer.reverse() . toString() ;
    
    if (  . equals(  ) )
      return true;
    else
      return false;

  }
}

public class PalindromeTester
{
  . . . . .
}

It is necessary to convert the two versions of azBuffer to a String because the StringBuffer class does not have an appropriate equals() method. However, we can use the method from String.

QUESTION 12:

Complete the method using the equals() method.