"Này, quân nhân!"
"Chúc một ngày tốt lành, thuyền trưởng!"
"Tôi có một tin tuyệt vời dành cho bạn. Đây là một số bài tập để củng cố kỹ năng của bạn. Hãy thực hiện chúng hàng ngày và kỹ năng của bạn sẽ phát triển với tốc độ chóng mặt. Chúng được tạo riêng cho IntelliJ IDEA."
"Những bài tập trước đó là dành cho tân binh. Tôi đã thêm một số bài tập bổ sung nâng cao hơn cho những người già. Chỉ dành cho những người kỳ cựu."
10
Nhiệm vụ
Java Core, mức độ, bài học
ABCs
The first parameter of the main method is a file name.
Count the letters in the file.
Display the number of letters.
Close the streams.
10
Nhiệm vụ
Java Core, mức độ, bài học
Spaces
The first parameter of the main method is a file name.
Display the ratio of the number of spaces to the number of all characters. For example, 10.45.
1. Count all the characters (n1).
2. Count the spaces (n2).
3. Display n2/n1*100, rounding to 2 decimal places.
4. Close the streams.
10
Nhiệm vụ
Java Core, mức độ, bài học
Two in one
Read 3 file names from the console.
Write the contents of the second file to the first file, and then append the contents of the third file to the first file.
Close the streams.
10
Nhiệm vụ
Java Core, mức độ, bài học
Combining files
Read 2 file names from the console.
Write the contents of the second file to the beginning of the first file so that the files are combined.
Close the streams.
20
Nhiệm vụ
Java Core, mức độ, bài học
Rounding numbers
Read 2 file names from the console.
The first file contains real (fractional) numbers, separated by spaces. For example, 3.1415.
Round the numbers to integers and write them, separated by spaces, to the second file.
Close the streams.
The rounding should work like this:
3.49 => 3
3.50 => 4
3.51 => 4
20
Nhiệm vụ
Java Core, mức độ, bài học
Symbol frequency
The program is started with one argument: the name of a file that contains text.
Calculate how often each symbol is encountered.
Sort the results by increasing ASCII code (read about it online). Example: ','=44, 's'=115, 't'=116.
Display the sorted results:
[symbol1] frequency1
[symbol2] frequency2
20
Nhiệm vụ
Java Core, mức độ, bài học
Finding data inside a file
Read a file name from the console.
Search the file for information related to the specified id. Display it in the format used in the file.
The program is started with one argument: id (an int).
Close the streams.
The file data is separated by spaces and stored in the following order:
id productName
20
Nhiệm vụ
Java Core, mức độ, bài học
Threads and bytes
Read file names from the console until the word "exit" is entered.
Pass the file name to the ReadThread thread.
The ReadThread thread should find the byte that occurs most frequently in the file, and add it to resultMap,
where the String parameter is the file name and the Integer parameter is the re
10
Nhiệm vụ
Java Core, mức độ, bài học
Files and exceptions
Read file names from the console.
If the file does not exist (i.e. an invalid file name is given), then
catch the FileNotFoundException, display the invalid file name, and exit the program.
Close the streams.
Don't use System.exit();
20
Nhiệm vụ
Java Core, mức độ, bài học
Building a file
Let's build a file from various pieces.
Read file names from the console.
Each file has a name: .partN. For example, Lion.avi.part1, Lion.avi.part2, ..., Lion.avi.part37.
The file names are supplied in random order. The word "end" is used to stop reading in file names.
In the folder where
10
Nhiệm vụ
Java Core, mức độ, bài học
Encryption
Come up with an encryption/decryption mechanism.
The program runs with one of the following sets of arguments:
-e fileName fileOutputName
-d fileName fileOutputName
where:
fileName is the name of a file to be encrypted/decrypted.
fileOutputName is the name of the file where you need to write the re
20
Nhiệm vụ
Java Core, mức độ, bài học
Prices
CrUD for a table inside a file.
Read a file name for CrUD operations from the console.
The program is started with the following arguments:
-c productName price quantity
Argument values:
where id is 8 characters.
productName is 30 characters.
price is 8 characters.
quantity is 4 characters.
-c adds
20
Nhiệm vụ
Java Core, mức độ, bài học
Prices 2
CrUD for a table inside a file
Read a file name for CrUD operations from the console
The program runs with one of the following sets of arguments:
-u id productName price quantity
-d id
Argument values:
where id is 8 characters
productName is 30 characters
price is 8 characters
quantity is 4 charact