string is a sequence of Unicode letters, digits,
type for representing text. As you’ll see shortly, you can
include string literals in your programs by enclosing them in
matching pairs of single or double quotation marks.
character data type such as
char, like C, C++, and
Java do. To represent a single character, you simply use a string
that has a length of 1.
A string is a sequence of zero
more Unicode characters enclosed within
single or double quotes
characters may be contained within strings delimited by single-quote
characters, and single-quote characters may be contained within
strings delimited by double quotes. String literals must be written
on a single line; they may not be broken across two lines. If you
need to include a newline character in a string literal, use the
, which is documented in the next
section. Examples of string literals are:
"" // The empty string: it has zero characters 'testing' "3.14" 'name="myform"' "Wouldn't you prefer O'Reilly's book?" "This string\nhas two lines" "pi is the ratio of a circle's circumference to its diameter"