A good answer might be:

The || (or operator) is the appropriate choice:

( chars.equals( "yes" ) || chars.equals( "YES" ) ||  
  chars.equals( "y" )   ||  chars.equals( "Y" )   )

Program with Alternatives

Since any one choice is all we need, the OR operation is the appropriate way to combine the choices. Here is the while loop version of the program modified in this way:

import java.io.* ;
class SqrtCalc
{
  public static void main( String[] args )
      throws IOException
  {
    String chars  ;
    double x;
    BufferedReader stdin = new BufferedReader( 
        new InputStreamReader(System.in) );

    chars = "yes" ;

    while ( chars.equals( "yes" ) || chars.equals( "YES" ) ||  
            chars.equals( "y" )   ||  chars.equals( "Y" )  )
    {
      System.out.print("Enter a number-->");
      chars = stdin.readLine(); 
      x     = Double.parseDouble( chars );
      System.out.println("Square root of " + x +
          " is " + Math.sqrt( x ) );
      System.out.print("Do you wish to continue? (yes or no) -->");
      chars = stdin.readLine();     
    }

  }
}

QUESTION 9:

Do you wish to continue?