转义字符


package lesson03;

public class DataDemo05 {
public static void main(String[] args) {
char ch1 = '\"'; //表示的是一个"
char ch2 = '\\'; //表示的是一个\
System.out.println("ch1 = " + ch1);
System.out.println("ch2 = " + ch2);
System.out.println("\"Hello World!\"");
}
}

运行结果:

ch1 = "
ch2 = \
"Hello World!"

posted @ 2021-03-13 21:55  coco9821  阅读(43)  评论(0编辑  收藏  举报