Java Basic Syntax--(for future review)

Source: Internet
Author: User
Tags arithmetic operators bitwise operators float double logical operators custom name

1. Key words

Concept: Words that are given special meaning by Java.

Example: Declaring a class keyword: class

Access Rights keyword: public

static modifier keyword: static

No return value type keyword: void

2. Identifiers

Concept: A name used to standardize a custom in a program

Composition: Alphanumeric underscore $

Spec: Cannot start with a number

Cannot contain spaces

Characters other than $ cannot appear

Cannot use keywords

Note: Identifiers in Java are strictly case-sensitive

Recommendation: Custom name best to be known

3. Data storage format

The data is stored in the computer in the form of a binary complement.

Positive numbers: The original code, the inverse code and the complement are consistent.

Negative Number: The original code: positive source code based on the highest position is 1.

Anti-code: negative source of the highest bit remains unchanged, the number of the remaining bits is reversed.

Complement: Negative inverse code +1.

Extension: Octal starts with 0

Hex 0x Start

Conversion between the binary:

Decimal to N binary: integer part: Divide by N, remainder inverse

Fractional part: Times n Rounding, Integer rounding

N-Decimal: Weighted Expansion summation method

4. Data operation

The highest level in binary is the sign bit

Smallest unit in computer: bit shorthand b

Minimum unit of processing data in a computer: shorthand byte b

5. Data type (Java is a strongly typed programming language)

Basic data types

Integer type

byte short int Long is the number of bytes: 1 2 4 8

Floating point Type

The number of bytes for a float double is: 4 8

Character type

The number of bytes that char occupies is: 2

Boolean type

The number of bytes in a Boolean is: 1

Reference data type

Interface type

Array type

Class type

6. Variables

Concept: A container for data that can change

Declaration format: Variable type variable name = data;

Suggested naming method: Small Hump name method: MaxValue

7. Data type Conversion

Small type turn large type: automatic type conversion

Large type turn small type: forced type conversion

8. Operators

Arithmetic operators

+ - * / % ++ --

Assignment operators

= += -= *= /= %=

logical operators

Logic and (&& or &)

Logic or (| | or |)

Logical XOR (^)

Logical NON (!)

Comparison operators

> < >= <=! = = = = = = =

Bitwise operators

Ternary operators

Escape character

9. How to compare the equality of string sequences: A.equals (b);

Compare the size of the string: A.compareto (b);

10, instanceof is a keyword and not a method, similar to the > number and the like.

Java Basic Syntax--(for future review)

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.