Java Notes 2

Source: Internet
Author: User

Variable data type variable name = variable Value

Note: Variables need to be assigned, no assignment can not be used;
variables use scoped limits;
Variables cannot be defined repeatedly;
The keyword cannot be used as a variable name.
Second, solve the confusion of different data type operation

1) x-Input: Every x into one, common two or eight, 16 or 16 binary.

2) binary conversion:
Arbitrary decimal: The weighted power of the coefficient * cardinality is added
Decimal to arbitrary binary: in addition to base rewind
Computers are present in binary form and are saved and calculated in a complementary fashion.

Code Anti-code complement
byte B = (byte) 130;
130:
SOURCE 1000 0010
Inverse code negative first invariant other bit negation
Complement to find out the anti-code +1
The positive number is the same as the source counter-complement

3) Conversion
Auto-convert (implicit)
Data type variable with large range = data type value with a small range;
such as: double d = 1000;
or int i = 100;
Double D2 = i;

Cast:
Range small Data type variable = (range small data type) range large data type value;
such as: int i = (int) 6.718; The value of I is 6
or double d = 3.14;
int i2 = (int) d; The value of I2 is 3

(data type) value

Three, operators (arithmetic, assignment, comparison, logic, ternary)

1) Arithmetic: ++a first increment, then calculate
a++ first operation, then self-increment

2) Assignment: + =,-=, *=,/=,%=

3) Compare:> < >= <=! = = =

4) Logic & | ^ ! && | |

5) Ternary operator: (conditional expression)? Expression 1: Expression 2;

Iv. Process Control Statements
1) Order

2) Select
Three formats for If loop
Switch
3) Cycle

Java Notes 2

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.