Java 中的转义字符

注意斜杠方向,为键盘右上角的斜杠


\t   在当前编辑位置插入一个 tab


\b   在当前编辑位置插入一个空格


\n   换行(在当前编辑位置插入 a newline)


\r   在当前编辑位置插入一个回车                  Insert a carriage return in the text at this point.


\f   在当前编辑位置插入换页符                     Insert a formfeed in the text at this point.


\'   插入一个单引号字符


\"   插入一个双引号字符


\\   插入反斜杠字符

 

比如:System.out.println("She said \"Hello!\" to me.");

posted @ 2015-10-28 19:14  木易·月  阅读(363)  评论(0编辑  收藏  举报