String arrays
Strings cannot be changed
The content of a String object in Java is immutable; Once created, it cannot be changed.
This immutability allows Java to implement strings more efficiently.
To create a variation of a String, you need to create a new String object.
Unused strings are automatically collected by the garbage collector.
Although the contents of a String are immutable, reference variables can change to point to other objects.
String substring(int initialindex, intfinalindex);
The substring() method exemplifies immutability, returning a new String without changing the original.
Program output:
orgstr: Java makes the Web move.
substr: makes the Web.
Original string orgstr remains unchanged and substr contains the substring.
The above is the detailed content of Arrays de strings. For more information, please follow other related articles on the PHP Chinese website!