Well-off accompany you to learn Java--------Java Basic Program Design Summary

Source: Internet
Author: User
Tags arithmetic operators

The previous period of time on the basic Java programming has been introduced, small part of this to do some summary, I hope to be helpful to everyone.

1, Java data types can be divided into the following two kinds: basic data type and reference data type.

2, Java provides a long, int, short, and byte four integer types of the maximum value, the minimum value of the code. The code for the maximum value is max_value, and the minimum value is min_value. If you use the maximum or minimum value of a type, simply precede the code with the full name of the class to which they belong.

3, Unicode, it has a unique value for each character, so in any language, platform, program can be used with ease.

4, Boolean (Boolean) type of variable, only true (true) and False (false) two values.

5, the conversion of data types can be divided into the following two kinds: "Automatic type conversion" and "forced type conversion".

6, the expression is composed of operands and operators.

7, a unary operator requires only one operand. such as "+3", "~a", "-a" and "!a" are composed of a unary operator and an operand.

8. The members of arithmetic operators are: addition operator, subtraction operator, multiplication operator, division operator, remainder operator.

9. If statement can decide the procedure according to the result of judgment.

10, increment and decrement operators have considerable convenience, use them to improve the simplicity of the program

11. Parentheses () are the Java operators that are used to handle the precedence of an expression.

12. When there is a type mismatch in the expression, the following processing methods are available: (1) data types that consume less bytes are converted to data types that consume more bytes. (2) with the short and int types, the int type. (3) The character type is converted to the short type. (4) The int type is converted to float type. (5) If the type of one operand is double, the other operands are also converted to a double type. (6) A Boolean type cannot be converted to another type.

13, the structure of the program comprises: (1) sequential structure, (2) selection structure, (3) loop structure.

14, the need to repeat a function, the cycle is the best choice. Depending on the needs and habits of the program, you can choose to use the for, while, and do...while loops provided by Java.

15. The break statement allows the forced program to escape the loop. When the program runs to the break statement, it leaves the loop, resumes execution of the next statement outside the loop, and if the break statement appears in the inner loop of the nested loop, the break statement only escapes the current layer loop.

16. The Continue statement can force the program to jump to the beginning of the loop, and when the program runs to the continue statement, it stops running the remaining loop body and continues at the beginning of the loop.

17, the choice structure includes if, if-else and switch statements, the sentence with the choice of structure, like a crossroads, according to different choices, the program will have different directions and results.

18, in the loop can also declare a variable, but the declared variable is only a local variable, as long as the jump out of the loop, this variable can no longer be used.

Related Article

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.