Java Basic Three

Source: Internet
Author: User

Java Fundamentals 31, keywords

Second, the identifier 2.1 definition

A symbol that identifies something: Name: A class name is one of the identifiers

26 English letters, 0-9,_ and $

2.2 Note

Numbers can not start

You can not use the keyword (your surname is not to call Tian ' an gate, this is the name of the country)

_ and $ are used to connect words

Third, comments

Very important

3.1 Effects:

Annotation description

Debug program

3.2 classification

Line Comment//

Block Comment/**/

Document Comment/*..........**/

3.3 Note

Interview on the machine to write notes, professional, novice veteran of the difference

Annotations are really super important and the specs are important

From today onwards, write code must be annotated

Comments can be written in pseudo-code, first of all to write

Write block annotation Write requirements first

Iv. Constants and Variables 4.1 definition and classification

Constants: Quantities that cannot be changed

Variable: The amount that can be changed

4.2 Java data types

Byte,short,int,long 1,2,4,8

Float dd=2.34f

4.3 Common errors

B1 and B2 are byte and may cross over if B1 and B2 are both 127

int is the default data type so no problem

int x=interger.max_value;

Five, operator 5.1 comparison operators

5.2 Logical operators

The upper part is also true, and the upper part can also be used for bitwise operations.

Double and double or short circuit

Single and double with the result is the same

5.3-bit operators

Unsigned Right Shift

The bitwise AND OR XOR or operation is the logical operator above

5.3.0 XOR encryption

6^3^3=6, you can encrypt a picture or something in this way.

The difference between 5.3.1 >> and >>>

>>: For high-level vacancies, what is used to fill the vacancy at the original high

>>>: Unsigned Right SHIFT, when the data is moved to the right, the high position of the vacancy, no matter what the original high, empty space with 0 complement

5.3.2 binary multiplication

So it's a lot quicker to use shift operations.

The essence of multiplication is also addition

5.3.3 Exchange Two numbers

With a number or the same number two times unchanged

Poor reading, with the interview

Developed in the form of third-party variables, because reading star strong

5.3.4 get the maximum number of three numbers

5.3.5 the role of local code blocks

For performance optimization, A is released.

Java Basic Three

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.