In the previous learning process, we are learning the basic characteristics of objects, the use of objects and the relationship between objects. Now we’re going to do things with objects, so before we do things with objects, we’re going to learn about some common objects that are provided in the API. First, learn how to use the API before learning about the Object class in the API. 1.1 Java API

Java API (API: Java apis are the classes in the JDK that encapsulate the underlying code implementation. We don’t need to care about how these classes are implemented, we just need to learn how to use them. There is a src.zip file in the JDK installation directory that contains the source files for all Java classes. You can view the source code of the corresponding class. Every time we look at a method in a class, we open the source code to look at it, which is too cumbersome. In fact, you can find out how to use the APIS provided by Java by looking at the help documentation. Operations as shown below: Find the Object class

With the introduction of classes and methods in the help documentation, we can use this class. 1.2 Overview of the Object Class

The Object class is the root class in the Java language, the parent class of all classes. All of the method subclasses described in it are available. When all classes create objects, they end up looking for the parent class Object. Of the many methods of the Object class, equals and toString are the first. The rest will be covered later in the course. 1.3 equals method

The equals method is used to compare the memory addresses of two objects. The equals method of the Object class uses the == comparison operator internally. In development, to compare two objects to see if they are the same or not, you often need to subclass equals to compare them based on their property values. The following code is shown: /* Describe the person class and define the function to determine whether the person is the same age as the specified class. */ class Person extends Object{int age; // Override the equals method of the parent, Public Boolean equals(Object obj){if(this == obj){return true; } // Determine if the object passed in is of type Person if(! (obj instanceof Person)){ return false; } // Cast obj down to Perosn reference, access its property Person p = (Person)obj; return this.age == p.age; }} Public Boolean equals(Object obj) equals(Object obj) equals(Object obj) equals(Object obj) public Boolean equals(Object obj) equals(Object obj) 1.4 the toString method

The toString method returns a string representation of the object, which is the object’s type +@+ memory address value. Because the toString method returns a memory address, and you often need to get a string representation based on an object’s attributes in development, you also need to override it. class Person extends Object{ int age ; Public toString() {return “Person [age=” + age + “]”; Chapter 2: String class 2.1 Overview of the String class

Looking at the description of the String class in the API, you see that the String class represents a String. All string literals (such as “ABC”) in Java programs are implemented as instances of this class. // Demo String String STR = “itcast”; STR = “podcasts “;

If YOU look at the API, it says strings are constants; What does it mean that their values cannot be changed after they are created? What that means is that once the string is identified, it will generate the string in memory. The string itself cannot be changed, but the address value recorded in the STR variable can be.

A further look at the API reveals that strings have a large number of overloaded constructors. String objects can be created using the String constructor, so what’s the difference between creating objects using double quotes and creating objects using new? String s3 = “ABC “; String s4 = new String(“abc”); System.out.println(s3==s4); //false System.out.println(s3.equals(s4)); // True, // Because String overrides equals, it establishes the same criteria for the String itself (judging by the characters in the String object)

What’s the difference between s3 and S4? L S3 created with only one object in memory. This object is created in the string constant pool L s4 and has two objects in memory. A new object in the heap, a string object itself, in the string constant pool

2.2 String class constructor

Constructors are used to create String objects. The following figure shows some of the constructors that need to be found in the API and can be used to create objects.

[Java] Plain text view copy code? 1 2 3 4 5 6 7 8 String s1 = new String(); [/align] byte[] bys = new byte[]{97,98,99,100}; String s2 = new String(bys); String s3 = new String(bys, 1, 3); Char [] CHS = new char[]{a ‘, ‘b’, ‘c’, ‘d’, ‘e’}; char[] CHS = new char[]{‘ a ‘, ‘b’, ‘c’, ‘d’, ‘e’}; String s4 = new String(chs); String s5 = new String(CHS, 0, 3); String s6 = new String(” ABC “); String s6 = new String(” ABC “); There are many commonly used methods in the String class. When we learn a class, we should not blindly try to use all the methods again. At this time, we should analyze the object according to the characteristics of the object should have those functions. So it’s easier for you to use. A string is an object, so its methods must be defined around manipulating the data on that object. So what are the functions of strings? L How many characters are in a string?

[Java] Plain text view copy code? 1 2 3 String str = “abcde”; int len = str.length(); System.out.println(“len=”+len); L Gets part of the string.

[Java] Plain text view copy code? 1 2 3 4 5 6 String str = “abcde”; String s1 = str.substring(1); // Return a new String from the specified position to the end of the String. String s2 = str.substring(2, 4); System.out.println(” STR =”+ STR); // Return a new string of characters from the specified position to the specified position. System.out.println(“s1=”+s1); System.out.println(“s2=”+s2); 2.4 String class method search exercise to give you a brief introduction to a few commonly used String methods, this process mainly let you learn how to go to the API, how to find their own method. Let’s practice finding string methods. L Specifies whether the string starts with a specified string. Same ending.

[Java] Plain text view copy code? 1 2 3 4 String str = “StringDemo.java”; boolean b1 = str.startsWith(“Demo”); Boolean b2 = str.startswith (“String”); boolean b3 = str.endsWith(“java”); // Check whether the l string contains another string.

[Java] Plain text view copy code? 1 2 3 String str = “abcde”; Int index = STR. IndexOf (” BCD “); Boolean b2 = STR. Contains (” BCD “); // Check whether the string contains the specified string. Returns true if it contains the specified string, false if it does not Or byte arrays.

[Java] Plain text view copy code? 1 2 3 String str = “abcde”; char[] chs = str.toCharArray(); byte[] bytes = str.getBytes(); L Determine whether the contents of two strings are the same

[Java] Plain text view copy code? 1 2 3 4 5 String str = “abcde”; String str2 = “abcde”; String str3 = “hello”; boolean b1 = str.equals(str2); boolean b2 = str.equals(str3); L Gets the contents of the string object

[Java] Plain text view copy code? 1 2 3 String str = new String(“hello”); System.out.println( str.toString() ); System.out.pintln( str ); When a reference type variable is printed directly, the default call to the type overridden toString method corresponding to the following requirements, requiring you to do your own work in the API to find, and method use. L to judge whether the content of the string is empty string l for a given character, first appeared in the string on the location of the access to the specified location in the string l l convert the string to lowercase string of characters l convert the string to uppercase string in the string, l will be given the old character, Replace l with a new character In this String, replace l with a new character for the given old String. Remove Spaces at both ends of the String, but not in the middle, and return a new String. L To count the number of uppercase letters, lowercase letters, and digits. Create 3 count variables. 2. To obtain each character in the string, perform string traversal to obtain each character. 3. Judge the obtained characters. If the characters are uppercase letters, the number of uppercase letters is +1. If the character is a lowercase letter, the number of lowercase letters +1. If the character is a number, the number of digits is +1. 4. Display the number of uppercase letters, lowercase letters, digits l code: [Java] plain text view copy code? 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 public static void method(String str){ int bigCount = 0; Int smallCount = 0; Int numberCount = 0; For (int I =0; i < str.length(); i++) { char ch = str.charAt(i); / / access to the specified location on the character of the if (ch > = ‘A’ && ch < = ‘Z’) {bigCount++; } else if (ch>= ‘a’ && ch<= ‘z’) {smallCount++; } else if (ch>= ‘0’ && ch<= ‘9’) {numberCount++; }} system.out. println(” uppercase: “+bigCount); System.out.println(” smallCount: “+smallCount); System.out.println(” Number of numbers: “+numberCount); } l Problem 2: Convert the first letter of the string to uppercase, the other letters to lowercase, and print the changed string. 1. Divide the string into two parts. The first part contains the first letter of the string, and the second part contains the rest of the string. 2. Convert the first string to uppercase and the second string to lowercase 3. Concatenate the two parts of the string together to get a complete string l code: [Java] plain text view copy code? 01 02 03 04 05 06 07 08 09 10 11 public static String convert(String STR){// Get the first part of the String String start = STR. The substring (0, 1); String end = str.substring(1); // convert the first part of the String toUpperCase and the second part of the String to lowercase String big = start.toUpperCase(); String small = end.toLowerCase(); Return big+small; return big+small; } l Query the number of occurrences of a specified small string in a large string. Such as “hellojava nihaojava, javazhenbang” “Java” query in the number of times. 1. Find the position of the small string in the large string, the number of occurrences +1 2. To continue the search after the location of the last small string, change the content of the large string to the string that was not queried last time. 3. Return to the first step, continue to find the location of the small string, until the large string can not be found in the small string until l code: [Java] plain text view copy code? 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 public static int getCount(String big, String small){ int count = 0; Int index = -1; Big.indexof (small) Get the position of the small string in the large string. Assign the position of the string to the index variable step three. Check whether the position is -1. If the position is -1, it indicates that the small string cannot be queried in the large string. */ while ((index = big.indexof (small)) */ while ((index = big.indexof (small))! = -1 ){ count++; Big = big.substring(index+1); } return count; } When we learned about String, the API said that String buffers support mutable strings. What is a String buffer? Next, let’s look at string buffers. Check out the API for a StringBuffer, also known as a mutable character sequence, which is a string-like String buffer whose length and content can be changed by some method calls. So a StringBuffer is a buffer of strings, which means it’s a container, and a container can hold a lot of strings. And can do various operations on the string. 3.2 StringBuffer method use

L Create a string buffer object. Used to store data. [Java] Plain text view copy code? 1 2 3 4 5 6 StringBuffer sb = new StringBuffer(); sb.append(“haha”); // add string sb. Insert (2, “it”); // Insert sb.delete(1, 4) at the specified location; // delete sb.replace(1, 4, “cast”); String STR = sb.toString(); L Note that the append, Delete, Insert, replace, and Reverse methods all return the current object itself, so StringBuffer changes the length and content of the character sequence. 3.3 StringBuffer Class Method Search exercise: Use the following StringBuffer class methods to find and use them. L Intercepts the string buffer from the specified position and returns a new string l On the basis of the original string buffer content, delete the character in the specified position 3.4 Object method chain call In our development, we will encounter a method after calling, return an object. The method is then continued with the returned object. In this case, we can put the code together, as in the append method: create a string buffer object. Used to store data. StringBuffer sb = new StringBuffer(); Add data. After continuously adding data, the last data in the buffer must be converted to a string to operate on. String str = sb.append(true).append(“hehe”).toString();

[Java] Plain text view copy code? 01 02 03 04 05 06 07 08 09 10 11 12 13 int[] arr = {34,12,89,68}; Public static String toString_2(int[] arr) {toStringBuffer sb = new StringBuffer(); sb.append(“[“); for (int i = 0; i < arr.length; i++) { if(i! =arr.length-1){ sb.append(arr+”,”); }else{ sb.append(arr+”]”); } } return sb.toString(); } l It doesn’t matter how much data there is or what type the data is, as long as it ends up as a string. What’s the difference between StringBuilder and StringBuffer? We read the StringBuilder API description and found that it is also a mutable character sequence. This class provides an API compatible with StringBuffer, but does not guarantee synchronization. This class is designed to be used as an easy alternative to StringBuffer when the StringBuffer is being used by a single thread (which is common). This class is preferred if possible, as it is faster than StringBuffer in most implementations. So far, we haven’t talked about threads and synchronization, but StringBuilder is faster than StringBuffer. Why is that fast? We’ll talk about that when we look at threads. L Object is a superclass of all classes. All classes in Java directly or indirectly inherit the l method public String toString() returns the contents of the current Object. For the Object class default operation, Public Boolean equals(Object obj) compares the contents of two objects. For the default operation on the Object class, the value of the address is compared. Boolean equals(Object obj) checks whether the contents of two strings are the same. Boolean equalsIgnoreCase(String STR) checks whether the contents of two strings are the same. Boolean contains(String STR) determines whether the String contains the given String Boolean startsWith(String STR) determines whether the String startsWith the given String Boolean EndsWith (String STR) checks whether the String endsWith the given String Boolean isEmpty() String that checks whether the String isEmpty “” int length() gets the length of the String char charAt(int String substring(int start) starts at the specified position and ends at the end, intercepts the String, Returns a new String String substring(int start,int end) starting at the specified position and ending at the specified position, intercepts the String, returns a new String int indexOf(int ch) to get the given character, Int indexOf(int ch,int fromIndex) gets the given character starting at the specified position, Char [] toCharArray() converts the String to an array of characters. String replace(char old,char new) In the String, Replace given old characters with new characters In the previous learning process, we are learning the basic characteristics of objects, the use of objects and the relationship between objects. Now we’re going to do things with objects, so before we do things with objects, we’re going to learn about some common objects that are provided in the API. First, learn how to use the API before learning about the Object class in the API. 1.1 Java API Java API Java apis are the classes in the JDK that encapsulate the underlying code implementation. We don’t need to care about how these classes are implemented, we just need to learn how to use them. There is a src.zip file in the JDK installation directory that contains the source files for all Java classes. You can view the source code of the corresponding class. Every time we look at a method in a class, we open the source code to look at it, which is too cumbersome. In fact, you can find out how to use the APIS provided by Java by looking at the help documentation. Operations as shown below: Find the Object class

With the introduction of classes and methods in the help documentation, we can use this class. 1.2 Introduction to The Object Class The Object class is the root class in the Java language, which is the parent class of all classes. All of the method subclasses described in it are available. When all classes create objects, they end up looking for the parent class Object. Of the many methods of the Object class, equals and toString are the first. The rest will be covered later in the course. 1.3 equals method

The equals method is used to compare the memory addresses of two objects. The equals method of the Object class uses the == comparison operator internally. In development, to compare two objects to see if they are the same or not, you often need to subclass equals to compare them based on their property values. The following code is shown: /* Describe the person class and define the function to determine whether the person is the same age as the specified class. */ class Person extends Object{int age; // Override the equals method of the parent, Public Boolean equals(Object obj){if(this == obj){return true; } // Determine if the object passed in is of type Person if(! (obj instanceof Person)){ return false; } // Cast obj down to Perosn reference, access its property Person p = (Person)obj; return this.age == p.age; }} Public Boolean equals(Object obj) equals(Object obj) equals(Object obj) equals(Object obj) public Boolean equals(Object obj) equals(Object obj) 1.4 the toString method

The toString method returns a string representation of the object, which is the object’s type +@+ memory address value. Because the toString method returns a memory address, and you often need to get a string representation based on an object’s attributes in development, you also need to override it. class Person extends Object{ int age ; Public toString() {return “Person [age=” + age + “]”; If you look at the description of the String class in the API, you find that the String class represents a String. All string literals (such as “ABC”) in Java programs are implemented as instances of this class. // Demo String String STR = “itcast”; STR = “podcasts “; If YOU look at the API, it says strings are constants; What does it mean that their values cannot be changed after they are created? What that means is that once the string is identified, it will generate the string in memory. The string itself cannot be changed, but the address value recorded in the STR variable can be.

A further look at the API reveals that strings have a large number of overloaded constructors. String objects can be created using the String constructor, so what’s the difference between creating objects using double quotes and creating objects using new? String s3 = “ABC “; String s4 = new String(“abc”); System.out.println(s3==s4); //false System.out.println(s3.equals(s4)); // True, // Since String overwrites equals (), String sets its own criteria for determining the String object (s), what is the difference between s3 and S4? L S3 created with only one object in memory. This object is created in the string constant pool L s4 and has two objects in memory. A new object in the heap, a string object itself, in the string constant pool

Constructors are used to create String objects. The following figure shows some of the constructors that need to be found in the API and can be used to create objects.

[Java] Plain text view copy code? 1 2 3 4 5 6 7 8 String s1 = new String(); [/align] byte[] bys = new byte[]{97,98,99,100}; String s2 = new String(bys); String s3 = new String(bys, 1, 3); Char [] CHS = new char[]{a ‘, ‘b’, ‘c’, ‘d’, ‘e’}; char[] CHS = new char[]{‘ a ‘, ‘b’, ‘c’, ‘d’, ‘e’}; String s4 = new String(chs); String s5 = new String(CHS, 0, 3); String s6 = new String(” ABC “); String s6 = new String(” ABC “); There are many commonly used methods in the String class. When we learn a class, we should not blindly try to use all the methods again. At this time, we should analyze the object according to the characteristics of the object should have those functions. So it’s easier for you to use. A string is an object, so its methods must be defined around manipulating the data on that object. So what are the functions of strings? L How many characters are in a string?

[Java] Plain text view copy code? 1 2 3 String str = “abcde”; int len = str.length(); System.out.println(“len=”+len); L Gets part of the string.

[Java] Plain text view copy code? 1 2 3 4 5 6 String str = “abcde”; String s1 = str.substring(1); // Return a new String from the specified position to the end of the String. String s2 = str.substring(2, 4); System.out.println(” STR =”+ STR); // Return a new string of characters from the specified position to the specified position. System.out.println(“s1=”+s1); System.out.println(“s2=”+s2); 2.4 String class method search exercise to give you a brief introduction to a few commonly used String methods, this process mainly let you learn how to go to the API, how to find their own method. Let’s practice finding string methods. L Specifies whether the string starts with a specified string. Same ending.

[Java] Plain text view copy code? 1 2 3 4 String str = “StringDemo.java”; boolean b1 = str.startsWith(“Demo”); Boolean b2 = str.startswith (“String”); boolean b3 = str.endsWith(“java”); // Check whether the l string contains another string.

[Java] Plain text view copy code? 1 2 3 String str = “abcde”; Int index = STR. IndexOf (” BCD “); Boolean b2 = STR. Contains (” BCD “); // Check whether the string contains the specified string. Returns true if it contains the specified string, false if it does not Or byte arrays.

[Java] Plain text view copy code? 1 2 3 String str = “abcde”; char[] chs = str.toCharArray(); byte[] bytes = str.getBytes(); L Determine whether the contents of two strings are the same

[Java] Plain text view copy code? 1 2 3 4 5 String str = “abcde”; String str2 = “abcde”; String str3 = “hello”; boolean b1 = str.equals(str2); boolean b2 = str.equals(str3); L Gets the contents of the string object

[Java] Plain text view copy code? 1 2 3 String str = new String(“hello”); System.out.println( str.toString() ); System.out.pintln( str ); When a reference type variable is printed directly, the default call to the type overridden toString method corresponding to the following requirements, requiring you to do your own work in the API to find, and method use. L to judge whether the content of the string is empty string l for a given character, first appeared in the string on the location of the access to the specified location in the string l l convert the string to lowercase string of characters l convert the string to uppercase string in the string, l will be given the old character, Replace l with a new character In this String, replace l with a new character for the given old String. Remove Spaces at both ends of the String, but not in the middle, and return a new String. L To count the number of uppercase letters, lowercase letters, and digits. Create 3 count variables. 2. To obtain each character in the string, perform string traversal to obtain each character. 3. Judge the obtained characters. If the characters are uppercase letters, the number of uppercase letters is +1. If the character is a lowercase letter, the number of lowercase letters +1. If the character is a number, the number of digits is +1. 4. Display the number of uppercase letters, lowercase letters, digits l code: [Java] plain text view copy code? 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 public static void method(String str){ int bigCount = 0; Int smallCount = 0; Int numberCount = 0; For (int I =0; i < str.length(); i++) { char ch = str.charAt(i); / / access to the specified location on the character of the if (ch > = ‘A’ && ch < = ‘Z’) {bigCount++; } else if (ch>= ‘a’ && ch<= ‘z’) {smallCount++; } else if (ch>= ‘0’ && ch<= ‘9’) {numberCount++; }} system.out. println(” uppercase: “+bigCount); System.out.println(” smallCount: “+smallCount); System.out.println(” Number of numbers: “+numberCount); } l Problem 2: Convert the first letter of the string to uppercase, the other letters to lowercase, and print the changed string. 1. Divide the string into two parts. The first part contains the first letter of the string, and the second part contains the rest of the string. 2. Convert the first string to uppercase and the second string to lowercase 3. Concatenate the two parts of the string together to get a complete string l code: [Java] plain text view copy code? 01 02 03 04 05 06 07 08 09 10 11 public static String convert(String STR){// Get the first part of the String String start = STR. The substring (0, 1); String end = str.substring(1); // convert the first part of the String toUpperCase and the second part of the String to lowercase String big = start.toUpperCase(); String small = end.toLowerCase(); Return big+small; return big+small; } l Query the number of occurrences of a specified small string in a large string. Such as “hellojava nihaojava, javazhenbang” “Java” query in the number of times. 1. Find the position of the small string in the large string, the number of occurrences +1 2. To continue the search after the location of the last small string, change the content of the large string to the string that was not queried last time. 3. Return to the first step, continue to find the location of the small string, until the large string can not be found in the small string until l code: [Java] plain text view copy code? 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 public static int getCount(String big, String small){ int count = 0; Int index = -1; Big.indexof (small) Get the position of the small string in the large string. Assign the position of the string to the index variable step three. Check whether the position is -1. If the position is -1, it indicates that the small string cannot be queried in the large string. */ while ((index = big.indexof (small)) */ while ((index = big.indexof (small))! = -1 ){ count++; Big = big.substring(index+1); } return count; } When we learned about String, the API said that String buffers support mutable strings. What is a String buffer? Next, let’s look at string buffers. Check out the API for a StringBuffer, also known as a mutable character sequence, which is a string-like String buffer whose length and content can be changed by some method calls. So a StringBuffer is a buffer of strings, which means it’s a container, and a container can hold a lot of strings. And can do various operations on the string. 3.2 StringBuffer method use

L Create a string buffer object. Used to store data. [Java] Plain text view copy code? 1 2 3 4 5 6 StringBuffer sb = new StringBuffer(); sb.append(“haha”); // add string sb. Insert (2, “it”); // Insert sb.delete(1, 4) at the specified location; // delete sb.replace(1, 4, “cast”); String STR = sb.toString(); L Note that the append, Delete, Insert, replace, and Reverse methods all return the current object itself, so StringBuffer changes the length and content of the character sequence. 3.3 StringBuffer Class Method Search exercise: Use the following StringBuffer class methods to find and use them. L Intercepts the string buffer from the specified position and returns a new string l On the basis of the original string buffer content, delete the character in the specified position 3.4 Object method chain call In our development, we will encounter a method after calling, return an object. The method is then continued with the returned object. In this case, we can put the code together, as in the append method: create a string buffer object. Used to store data. StringBuffer sb = new StringBuffer(); Add data. After continuously adding data, the last data in the buffer must be converted to a string to operate on. String str = sb.append(true).append(“hehe”).toString();

[Java] Plain text view copy code? 01 02 03 04 05 06 07 08 09 10 11 12 13 int[] arr = {34,12,89,68}; Public static String toString_2(int[] arr) {toStringBuffer sb = new StringBuffer(); sb.append(“[“); for (int i = 0; i < arr.length; i++) { if(i! =arr.length-1){ sb.append(arr+”,”); }else{ sb.append(arr+”]”); } } return sb.toString(); } l It doesn’t matter how much data there is or what type the data is, as long as it ends up as a string. What’s the difference between StringBuilder and StringBuffer? We read the StringBuilder API description and found that it is also a mutable character sequence. This class provides an API compatible with StringBuffer, but does not guarantee synchronization. This class is designed to be used as an easy alternative to StringBuffer when the StringBuffer is being used by a single thread (which is common). This class is preferred if possible, as it is faster than StringBuffer in most implementations. So far, we haven’t talked about threads and synchronization, but StringBuilder is faster than StringBuffer. Why is that fast? We’ll talk about that when we look at threads. L Object is a superclass of all classes. All classes in Java directly or indirectly inherit the l method public String toString() returns the contents of the current Object. For the Object class default operation, Public Boolean equals(Object obj) compares the contents of two objects. For the default operation on the Object class, the value of the address is compared. Boolean equals(Object obj) checks whether the contents of two strings are the same. Boolean equalsIgnoreCase(String STR) checks whether the contents of two strings are the same. Boolean contains(String STR) determines whether the String contains the given String Boolean startsWith(String STR) determines whether the String startsWith the given String Boolean EndsWith (String STR) checks whether the String endsWith the given String Boolean isEmpty() String that checks whether the String isEmpty “” int length() gets the length of the String char charAt(int String substring(int start) starts at the specified position and ends at the end, intercepts the String, Returns a new String String substring(int start,int end) starting at the specified position and ending at the specified position, intercepts the String, returns a new String int indexOf(int ch) to get the given character, Int indexOf(int ch,int fromIndex) gets the given character starting at the specified position, Char [] toCharArray() converts the String to an array of characters. String replace(char old,char new) In the String, Replace (String old,String new) with a new String. Trim () removes Spaces on both ends of the String. Return a new String String toLowerCase() converts that String toLowerCase String toUpperCase() converts that String toUpperCase String int indexOf(String STR,int fromIndex) Starting from the specified location, access to a given string, the string in the position of the first occurrence of the l StringBuffer/StringBuilder: L method public StringBuffer appEnd (String STR) Insert (int offset,String STR) Public StringBuffer insert(int offset,String STR) Public StringBuffer deleteCharAt(int index) Public StringBuffer deleteCharAt(int index) Public StringBuffer delete(int start,int end) Delete (int start,int end) Public StringBuffer replace(int start,int end,String STR) Public StringBuffer replace(int start,int end,String STR) Public StringBuffer Reverse () Reverses the contents of the String buffer “ABC “—-” CBA” public String SubString (int start) Public String SubString (int start,int end) Public String subString (int start,int end) Public String substring(int start,int end) Return String replace(String old,String new) in this String, replace String trim() with a new String. Trim () removes Spaces on both ends of the String. Return a new String String toLowerCase() converts that String toLowerCase String toUpperCase() converts that String toUpperCase String int indexOf(String STR,int fromIndex) Starting from the specified location, access to a given string, the string in the position of the first occurrence of the l StringBuffer/StringBuilder: L method public StringBuffer appEnd (String STR) Insert (int offset,String STR) Public StringBuffer insert(int offset,String STR) Public StringBuffer deleteCharAt(int index) Public StringBuffer deleteCharAt(int index) Public StringBuffer delete(int start,int end) Delete (int start,int end) Public StringBuffer replace(int start,int end,String STR) Public StringBuffer replace(int start,int end,String STR) Public StringBuffer Reverse () Reverses the contents of the String buffer “ABC “—-” CBA” public String SubString (int start) Public String SubString (int start,int end) Starts at the specified position and ends at the specified position, intercepts the String buffer and returns a new String