Java learning basics daysof02

Source: Internet
Author: User

1.1. constants and variables

A constant is a value that cannot be changed. Constants include Integer constants, decimal constants, Boolean constants, string constants, and null constants. Here we will focus on several constants. A character constant can only store one character, but it can store one Chinese character. Because Java uses unicode encoding. Boolean constants only have true and false values.

The Data Types of variables include basic data types and reference data types:


Operators include Arithmetic Operators, value assignment operators, comparison operators, logical operators, bitwise operators, and ternary operators. Auto-increment and auto-subtraction in arithmetic operators. They are divided into pre-auto-increment and post-auto-increment, such as int A = 3; int B = A ++; the value of A is 4, and the value of B is 5; therefore, we can conclude that a ++ is used first and auto-increment. If B = ++ A; then a = 5, B = 5, therefore, ++ A can see that it can be used only after auto-increment. Escape characters are used to convert the meanings of letters or symbols following them. \ N = line feed, \ B = backspace, \ r = tab, \ "= double quotation marks, and so on.

1.2. process control.

In process control, if statements are divided into three types:
Format 1:

If (condition ){

// Execute the statement

}
Format 2:
If (condition ){

// Execute the statement

} Else {

// Execute the statement

}

Format 3:
If (condition ){

// Execute the statement

} Elseif (condition ){

// Execute the statement

} Else {

// Execute the statement

}

The Selection in Process Control is represented by the switch keyword. The syntax format is:
Switch (condition)

{

Case value1:

// Execute the statement

Break;

Case value2:

// Execute the statement

Break;

Case valuen:

// Execute the statement

Break;

Default

// Execute the statement

Break;

}

1.3. Summary

The knowledge in this chapter is messy, and I don't know how to organize it. It's strange to write trivial things, just like copying and pasting them. The previous sentence is basically different from the last one. In general, the next day's lesson explains the knowledge about constants and variables. The vague ones may be self-increment and auto-subtraction, which is hard to understand at the beginning. With the development of programming, thanks to the code, I feel very natural. At last, I posted my learning Mind Map:

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.