String()
String(byte[] src, int offs, int cnt)
Throws:
String(char[] src)
String(char[] src, int offs, int cnt)
Throws:
String(String other)
String(StringBuffer sb)
_INSERT_METHOD_SIGNATURE_HERE_
Description:
constructor String():
Create a String object that represents an empty character sequence.
constructor String(byte[] src, int offs, int cnt):
Constructs a new String by decoding the specified subarray of bytes using UTF8 encoding.
constructor String(char[] src):
Allocates a new String so that it represents the sequence of characters currently contained in the character array argument.
Note that characters in the Java Virtual Machine are only represented with one byte. Only the lowest byte of a Unicode symbol will be stored in a charater variable (see example below).
constructor String(char[] src, int offs, int cnt):
Allocates a new String that contains characters from a subarray of the character array argument.
Note that characters in the Java Virtual Machine are only represented with one byte. Only the lowest byte of a Unicode symbol will be stored in a charater variable (see example below).
constructor String(String other):
Creates a String object that is a copy of the argument string.
constructor String(StringBuffer sb):
Allocates a new string that contains the sequence of characters currently contained in the string buffer argument.
Examples
byte[] bytes = {(byte)0xE2, (byte)0x88, (byte)0x80}; // UTF8 code for "∀"
String str = new String(bytes, 0, 3); // initializes String to "∀"
char c = 'μ'; // c will have the value 0xBC although the Unicode symbol is 0x3BC.