next up previous
Next: Accessibility of objects Up: Unit 02 Previous: Invocation of a constructor

Empty string

The empty string represents the sequence of characters of length 0, and can be denoted by the literal "".

The class String has a constructor without parameters that creates an empty string:

String emptystring = new String();

The other constructor that we have seen for strings takes a string as parameter. hence, the two constructors have different signatures. This is a case of overloading.

Note: do not confuse the empty string with value null.


next up previous
Next: Accessibility of objects Up: Unit 02 Previous: Invocation of a constructor