javase-Character and Boolean type

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.