In fact, the Java Data Type section can be completely finished, why also need character and Boolean, because these two are very important:
The character type is represented by Char, which is divided into three types:
Normal character: char a = ' a ', ordinary character denotes an ordinary character, no actual meaning
Escape character: char b = ' \ \ ', an escape character means that the character does not represent the current meaning, while escaping is a different meaning,
Unicode encoding: char c = ' \u66c9 '; Uncode encoding is a powerful encoding that can represent all languages in the world, each language has a coordinate, like the chess chess board, each of which represents a Chinese character, a letter, or a different language.
Boolean type is one and only two values, true or False
Package com.java.chap02;
public class Demo03 {
public static void Main (string[] args) {
Define a single character
Char c1= ' A ';
Char c2= ' B ';
Char c3= ' 3 ';
System.out.println ("c1=" +c1);
System.out.println ("c2=" +c2);
System.out.println ("c3=" +c3);
Escape character
Char c4= ' \ ';
char c5= ' \ \ ';
System.out.println ("c4=" +c4);
System.out.println ("c5=" +c5);
Use Unicode encoding to output your name
Char c6= ' \u66c9 ';
Char c7= ' \u957b ';
System.out.println (c6+ "" +c7);
Defines a Boolean type of variable B1
Boolean b1=true;
System.out.println ("b1=" +b1);
Defines a Boolean type of variable B2
Boolean b2=false;
System.out.println ("b2=" +b2);
}
}
javase-Character and Boolean type