Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Bạn có thể đến một số kết luận tổng quát về những gì các đặc điểm của BinaryTree của bạn lớp đang có được bằng cách xem xét nó sẽ làm việc như thế nào. Đối tượng Node loại đang có được một phần cơ bản của một cây nhị phân. Các đối tượng Node trong cây thực sự là một phần của các hoạt động bên trong của container | A Collection of Useful Classes In Java a regular expression is compiled into a Pattern object that you can then use to obtain a Matcher object that will scan a given string looking for the pattern. The appendReplacement method for a Matcher object enables you to make substitutions for patterns found in the input text. A capturing group in a regular expression records the text that matches a subpattern. By using capturing groups you can rearrange the sequence of substrings in a string matching a pattern. A Scanner object uses a regular expression to segment data from a variety of sources into tokens. 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. 1. Define a static method to fill an array of type char with a given value passed as an argument to the method. 2. 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. 3. Write a program to display the sign of the Zodiac corresponding to a birth date entered through the keyboard. 4. Write a program using regular expressions to remove spaces from the beginning and end of each line in a file. 5. 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. 6. 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. 721 16 Threads In this chapter you ll investigate the facilities Java has that enable you to overlap the execution of segments of a single program. As well as ensuring your programs run more efficiently this capability is particularly useful when your program must of necessity do a number of things at the same time