2019JAVA fifth week experiment report

Java test report

Class Jike second class Student ID 20188442 Name Wu Yijun
completion time 2019.9.24
rating scale
application of third experiment String class

First, the purpose of the experiment

Master the use of class String class;
learn to use JDK help documentation;

Second, the experimental content

1. Known string: "this is a test of java " required to do the following requirements :( source code, the results screenshot).
2. count the number of letters in the string s appears.
3. Statistical neutron string the string "is" number of occurrences.
4. count the number of words in the string "is" appears.
5. Implement reverse the string is output.

Experiment Code



The first question Summary: Overall, the first question is relatively simple, just need to find the corresponding method, you can then reference the key is to skillfully use String methods, there is some simple arithmetic, you can master, self feel good.

2. Write a program, using the following algorithm to encrypt or decrypt the English string input by the user. It requires source code, the results screenshot.

The second question Summary: This topic first I did not think so much, that title means that all the characters move back three units at the same time, for this problem, the main idea is the most important thing is to become a string of characters array, and then forced to move back inside the array of characters in three units, the result is achieved. But for this problem, I also saw assistant asked the teacher, that as long as the first three characters moved back three units, other characters intact, and I looked at, this change is relatively simple, just a change position, then my roommate Lei discovered that each character must change, rather than changing three characters, of course, I think this kind of thinking is very good, to achieve these two questions are relatively simple, the key is to learn the ability to be careful moderation.

3. Given the string "ddejidsEFALDFfnef2357 3ed". The output string in the number of capital letters, lowercase letters count, the number of non-English letters.

The third problem Summary: I think this question is the easiest, because I feel as long as you can learn C have invented it, this is not wordy, the main use of the ASCII range of characters can then be classified.

Lessons Learned:

1. This chapter is mainly about a lot of methods of the String class, mainly familiar with these methods, of course, a rather special is that StringBuffer, to master these methods sometimes can take a lot of detours less in the face of practical problems.
2. then referred to the overload and override methods, which have considerable application in inheriting the parent class and subclass.

Guess you like

Origin www.cnblogs.com/521-PENG/p/11600697.html