Exercises

To extend your knowledge of the subjects covered today, try the following exercises:

  • Using the countDays() method from the DayCounter application, create an application that displays every date in a given year in a single list from January 1 to December 31.

  • Create a class that takes words for the first 10 numbers (one up to ten ) and converts them into a single long integer. Use a switch statement for the conversion and command-line arguments for the words.

Where applicable, exercise solutions are offered on the book's Web site at http://www.java21days.com.

Get Sams Teach Yourself Java 2 in 21 Days, Second 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.