1.1 Changes: String Class

The JDK 1.1 release added many features to make it easy for programmers to develop internationalized programs. Some changes were required to the String class to make it a better international citizen. In fact, all of the changes made to the String class are related to internationalization issues.

Be careful: Some uses of the String and StringBuffer classes may compromise the "international quality" of your program. See Writing Global Programs(in the new JDK 1.1 documentation) for a discussion about managing text in a global fashion.

Deprecated Methods

The first column in the following table lists the constructors and methods in the String class that are deprecated in the JDK 1.1. The second column lists alternatives for those constructors and methods:

Deprecated Methods Alternatives
String(byte[], int) String(byte[], String)
String(byte[], int, int, int) String(byte[], int, int, String)
getBytes(int, int, byte[], int) byte[] getBytes(String) or byte[] getBytes()
These constructors and methods were deprecated because they did not properly convert bytes into characters. The new constructors and methods use a named character-encoding or the default character-encoding to do the conversion.

New Methods

These constructors and methods were added to the String class for the JDK 1.1.
String(byte[], int, int)
String(byte[], String)
String(byte[], int, int, String)
byte[] getBytes(String)
byte[] getBytes()
String toLowerCase(Locale)
String toUpperCase(Locale)
The four new constructors and the two new getBytes methods are described in the previous section. The other two methods, toLowerCase and toUpperCase convert the String to lower or upper case according to the rules in the specified Locale(in the API reference documentation). For information about Locales and writing internationalized programs, see the new lesson Writing Global Programs(in the new JDK 1.1 documentation).