In C, a string literal represents an array of characters (the char primitive data type). However, as you will learn soon, Java does not follow suit. The following code provides some examples of the use of a string literal and the \t escape characters:
“This is a test”
“This is V test”
The first line above simple prints out the statement “This is a test.” The second line prints out the same thing, but places a tab where the \t is so, when printed, it will look something like “ This is a \test.”
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment