Guangdong Embedded Java Training First Day notes-java basic concept

Source: Internet
Author: User
Tags bitwise

One or two binary number

1, the highest bit is 0, indicates a positive number, the highest bit is 1, indicates a negative number.

2, the corresponding negative and positive conversion between the way: through the complement of the conversion, that is: reverse and add 1.

For example: 0000 0001 means +1; after 0000 0001 is reversed: 1111 1110, then 1111 1110+1=1111 1111, binary 1111 1111 equals-1.

3, 8-bit binary number, the maximum and minimum value that can be represented.

Maximum value: 0111 1111=127, i.e. 2^ (8-1) -1=127. (because it is calculated from 0, it can represent 0~127).

Minimum value: 1000 0000 = 128, i.e. -2^ (8-1) =-128.

What are the concepts of 4, 32-bit operating system and 64-bit operating system respectively?

2^10=1024k;

2^20=1m;

2^30=1g;

2^32=4g; (4G what concept: 4G is about 4.29 billion).

As can be seen from the above calculation: the32-bit operating system supports a maximum of 4G of memory.

2^40=1t;

2^40=1e

2^50=1t;

2^60=1z;

2^64=16z;

Obviously, the 64-bit operating system supports a large amount of memory.

Ii. Types of data

1. There are two kinds of data types in Java: Basic data type, reference data type.

2, 8 kinds of basic data types:

Boolean: Boolean (1-bit, in Java, whose value can only be true or false, cannot be represented by 1 or %).

Integer: Byte (8-bit, byte-unit, one byte for one bytes), short (16-bit, shorter-integer), int (32-bit, integer), long (64-bit, long-integer)

Float type: Float (32-bit, single-precision float), double (64-bit, double-precision floating-point type)

Character type: char (16 bits, one char for one character), one char equals 2 bytes

3. Conversion between 8 basic data types

    The Boolean type cannot be converted to another data type .

Conversion between the other 7 data types (conversion without losing precision) rules are as follows:

    

The data type you want to convert in reverse, requires a cast.

4. Reference data type: Array, class, interface;

Data of reference data types need to be created with the New keyword.

Third, operator (operators)

1, classification: unary operator, two-dollar operator, ternary operator.

Unary operators: + + (self-increment) 、--(decrement),-(minus sign), + (plus),! (non), ~ (bitwise negation).

Binary operators: +-*/% + = = *=/=%= && (with) & (bitwise VS) | | (OR) | (bitwise OR) &&= | | = = (Assignment) = = (judging if equal)! = > >= < <=

Ternary operator (trinocular operator):? :, A?b:c judge A, if true, then B, otherwise c. For example: (4>2)? 1:0, first to determine whether 4>2 this equation is set up is 1, or 0. Therefore, it should be 1.

2. Precedence of various operators:

      

Iv. the difference between break and continue

  Break: Jump out of the loop, no longer execute the loop statement;

Continue: Jump out of this loop, no longer loops the rest of the content, but executes the next loop.

Guangdong Embedded Java Training First Day notes-java basic concept

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.