String
A string is a sequence of characters.
Related concepts: ValueTypeSequence
Closest Wikipedia entry: String (computer science) — In computer programming, a string is traditionally a sequence of characters, either as a literal constant or as some kind of variable. The latter may allow its elements to be mutated and the length changed, or it may be fixed (after creation). A string is generally considered as a data type and is often implemented as an array data structure of bytes (or words) that stores a sequence of elements, typically characters, using some character encoding.
Misconceptions about String17 documented Misconceptions
Check YourselfArithmeticPlusPrecedes
Addition has higher precedence than string concatenationCharNotNumeric
Char is not a numeric typeLiteralString
When passing a literal string as argument to a method, no quotes are neededNoCallOnStringLiteral
One cannot invoke methods on String literalsNoCharEscape
\ is a normal character in char and String literalsNoStringToString
One cannot invoke toString() on a StringSingleQuoteString
String literals can be in single quotesStringLengthField
One can know the length of a String object by accessing its length fieldStringLiteralNoObject
One needs to call the String constructor to get a String object from a literalStringPlusStringifiesExpression
String concatenation stringifies non-String operand expressionsStringRepetitionOperator
The multiplication operator can repeat a String a number of timesToStringPrints
Invoking toString() prints something