Holiday week progress report six (8.5-8.11)

A. Most of the time this week spent on these areas

1. Look java reference e-books

2. Write B report

3. Read the classic book "Road to Jane."

4. Read the "Unified Modeling Language"

In addition to writing daily reports about two hours learning about one hour time will come to see java e-book and the Unified Modeling Language, the rest of the time with a look at the classic books

II. This week harvest

1. the Java language

First, use a switch statement;

Second, the class definition of the string operation and the common character string;

1. In a switch statement, the value of the constant expression case statement may be an integer, but may not be a real number, for example, case 1.1

2. In the Java language will be managed as a string object.

3. Create a string

1.String s=new String("good")   char a[]={'g','o','o','d'} String s=new String(a) 等价于String s=new String("good");

2.String(char a[],int offset,int length) char a[]={'s','t','u','d','e','n','t'} String s=new String(a,2,4) 等价于String  s=new String("uden");

3.String(char[] value) char a[]={'s','t','u','d','e','n','t'} String s=new String(a) 等价于 String s=new String("Student");

4.String str1, str2; str1 = "We are students" str2 = "We are students" case str1 str2 reference the same string constant, hence the same entity, pointing to the same memory.

4. Use the "+" operator connection function may be implemented in a plurality of strings. '+' Operator can be connected to a plurality of operators and generating a String object. String also be connected with other basic data types, if the data string is connected with these types of data, the data will be directly converted into a string, as long as the "+" in the operand of a string compiler the other operand will be converted to a string

5.str.length () Get string length, string search using the indexOf () and lastIndesOf () method, str.indexOf (a), the index to find a character position in the string str (starting from 0), str .lastIndesOf (substr), returns the index of the last specified string (substr) appears. If not found, returns -1. If lastIndexOf () method of the parameter string is empty (no space), the result returned is invoked with the same string length returns the result () method.

6. Get the specified index character charAt (), Example: str.charAt (6) acquires the position of the string str index 6 return character. Obtaining sub-string: substring (int beginIndex) // space accounted index position substring (int beginIndex, int endIndex) where the first endIndex character is not output.

7. remove spaces, str.trim () ignores leading spaces and trailing spaces.

8. string substitution: replace (char oldChar, char newChar), note that if the character to replace repeated, are all replaced.

9. Analyzing beginning and end of the string: str.startsWith (String prefix), prefix prefix character, str.endsWith (String suffix), suffix suffix characters.

10. determines whether strings are equal, can not ==, this is the address compare two strings are the same, str.equals (String otherstr), equalsIgnoreCase (String otherstr) ignoring case

11. lexicographically comparing strings str.compareTo (String otherstr), if prior to this String object lexicographically parameter string is located, the comparison result is a negative integer; the contrary is a positive integer, the compareTo () method only equals (Object) method returns true if 0.

12. letter case change str.toLowerCase (), str.toUpperCase (), dividing the string, str.split (String sign), str.split (String sign, int limit) sign: dividing string delimiter, limit : dividing the number of restrictions, if you want to define multiple note separator may be used, "|", "| =" represents a delimiter are ",", and "=."

13.for (element variable x: traverse the object obj) {x references the Java language;}

III. The problems encountered

  The main problem is in reading Java has a bibliography, when a lot of content is not previously had contact, sometimes do not understand, most of the test yourself or online access.

Four experiences:

        In the face of their own language is not the point, go to test their own coding, the only way to grow and harvest there, you can also go online to find their answers, it is efficient.

Five next week plan:

       First, the reports continue to organize holidays B;

       Second, we continue to learn java

Guess you like

Origin www.cnblogs.com/xp-thebest/p/11333794.html