End of Chapter

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.

Answer:

  boolean equals( String strA, String strB )
  {
    if       ( strA.length() == 0 && strB.length() == 0 )
      return true;
      
    else if  ( strA.length() == 0 && strB.length() != 0 )
      return false;
      
    else if  ( strA.length() != 0 && strB.length() == 0 )
      return false;
      
    else if  ( strA.charAt(0) != strB.charAt(0) )
      return false;
      
    else
      return equals( strA.substring(1), strB.substring(1) );
  }

End of Chapter

You have reached the end this chapter. If you are equal to it, review the following. Click on a subject that interests you to go to where it was discussed.

You have reached the end of the chapter.

go to previous page   go to home page