Explain java.lang.string library in java?
Strings are objects. Specifically they're instances of the class java.lang.String
. This class has several methods which are useful for working along with strings.
Internally Java Strings are arrays of Unicode characters. For instance the String "Hello"
is a five element array. Like arrays, Strings starts counting at 0. Therefore in the String "Hello"
'H'
is character 0, 'e'
is character 1, and so on.