Activities

You can review the topics of this hour more fully with the following activities:

  • Write a short Java program called Favorite that puts the code from this hour's “Comparing Two Strings” section into the main() block statement. Test it out to make sure it works as described and says that Ada's favorite instrument is not the ukulele. When you're done, change the initial value of the guess variable from ukulele to piano. See what happens.

  • Modify the Credits program so that the names of the director and all performers are displayed entirely in uppercase letters.

To see Java programs that implement these activities, visit the book's website at http://www.java24hours.com.

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.