String
Constructors
String class provides various types of constructors to create String
objects. Some of them are,
String()
Creates a new String object whose content is empty i.e. “”.
String(String
s)
Creates a new String object whose content is same as the String
object passed as an argument.
Note: Constructor creates a new string means it
does not intern the String. Interned String object reference can
be obtained by using intern() method of the String class.
String also provides constructors that take byte and char array
as argument and returns String object.
|