15.8. Exercises
You can download the source code for the examples in the book and the solutions to the following exercises from http://www.wrox.com.
Define a static method to fill an array of type char[] with a given value passed as an argument to the method.
For the adventurous gambler—use a stack and a Random object in a program to simulate a game of Blackjack for one player using two decks of cards.
Write a program to display the sign of the Zodiac corresponding to a birth date entered through the keyboard.
Write a program using regular expressions to remove spaces from the beginning and end of each line in a file.
Write a program using a regular expression to reproduce a file with a sequential line number starting at "0001" inserted at the beginning of each line in the original file. You can use a copy of your Java source file as the input to test this.
Write a program using a regular expression to eliminate any line numbers that appear at the beginning of lines in a file. You can use the output from the previous exercise as a test for your program.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access