string

public final class String extends Object implements Serializable, Comparable<String>, CharSequence String 类型继承 Serializable, Comparable<String>, CharSequence 接口。 The String class represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class. string类表明字符串,在java程序中,全部的string 字面值,好比abc ,都是实现这个类的实例。java

Strings are constant; their values cannot be changed after they are created. String buffers support mutable strings. Because String objects are immutable they can be shared. For example: string 类型是常量,他们被建立后不会背改变,字符串缓冲区支持可变的字符串,由于他们可共享字符串的 对象是不可变的 ,以下面两个是相等的 。 String str = "abc";app

is equivalent to:less

char data[] = {'a', 'b', 'c'};
 String str = new String(data);

Here are some more examples of how strings can be used: 下面有更多的列子 System.out.println("abc"); String cde = "cde"; System.out.println("abc" + cde); String c = "abc".substring(2,3); String d = cde.substring(1, 2);ide

The class String includes methods for examining individual characters of the sequence, for comparing strings, for searching strings, for extracting substrings, and for creating a copy of a string with all characters translated to uppercase or to lowercase. Case mapping is based on the Unicode Standard version specified by the Character class.函数

string 类方法包含对单个字符序列的审查,如比较字符串,查找字符串、提取子串和建立字符串的副本将其转换成大写或者小写,映射状况下基于unicode字符串的标准版。ui

The Java language provides special support for the string concatenation operator ( + ), and for conversion of other objects to strings. String concatenation is implemented through the StringBuilder(or StringBuffer) class and its append method. String conversions are implemented through the method toString, defined by Object and inherited by all classes in Java. For additional information on string concatenation and conversion, see Gosling, Joy, and Steele, The Java Language Specification.this

java语言包含专门支持字符串的符号和转换成字符串的方法,字符串的执行经过他的stringbuilder类和它的附加方法。string 包含tostring方法,定义object和继承全部的java类,字符串转换和链接的全部信息参考gosling,joy 和steele中的java语言规范编码

Unless otherwise noted, passing a null argument to a constructor or method in this class will cause a NullPointerException to be thrown.指针

除非在特殊的状况下,经过null值访问一个类的构造函数或者方法将会被抛出一个空指针异常。code

A String represents a string in the UTF-16 format in which supplementary characters are represented by surrogate pairs (see the section Unicode Character Representations in the Character class for more information). Index values refer to char code units, so a supplementary character uses two positions in a String. 一个字符串表明一个字符串补充格式utf16的字符串,索引值是指编码单元,因此补充字符串在字符串中占用了2个位置。 The String class provides methods for dealing with Unicode code points (i.e., characters), in addition to those for dealing with Unicode code units (i.e., char values).

Since: JDK1.0 See Also: Object.toString(), StringBuffer, StringBuilder, Charset, Serialized Form