Home >Java >javaTutorial >Difference between Strings and Character Literals
Is a string consisting of a single character the same as a character literal? For example, is "k" the same as 'k'?
Character Literal:
Single Character String:
Example: "k".
Notice how the n escape sequence is used to generate a new line.
You don't need to use multiple println( ) statements to get multiline output. Just embed n in a longer string at the points where you want the newline to occur.
The above is the detailed content of Difference between Strings and Character Literals. For more information, please follow other related articles on the PHP Chinese website!