End of the 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.
go to previous page   go to home page          
String burns = "My love is like a red, red rose.";
. . . . . .
if ( burns.toLower().startsWith( "  MY LOVE".trim().toLower() ) )
  System.out.println( "Both start with the same letters." );
else
  System.out.println( "Prefix fails." );

What does the above write to the monitor?

Answer:

Both start with the same letters.

End of the Chapter

That was a complicated question. I hope you rose to the occasion. If you got burned, review the example. You may wish to review the following.

You have reached the end of the chapter.

go to previous page   go to home page