The basic data types char

char type constant is a Class contains only one common character is the escape character another

Characters and contain characters display and non-display characters, the ASCII table to check on it

 

 

char type is automatically promoted to an int

1 public static void main(String[] args) {
2     System.out.println('\t');
3     System.out.println("\t");
4     System.out.println(0+'\t');
5     System.out.println(0+"\t");
6     
7     int c = '\t';
8     System.out.println(c);
9 }

Output:

See '\ t', and the same "\ t" effect, is a tab

And 0 + '\ t' char type '\ t' is automatically elevated to int type, '\ t' corresponding to the ASCII value 9, the 0 + '\ t' value 9

In double quotes, then, is simply the escape character tabs

Guess you like

Origin www.cnblogs.com/shizunatsu/p/11401461.html