Java Basic syntax

Source: Internet
Author: User

Comments

---> Single line comments

/* */---> Multiline comments

/** */---> Documentation notes, Java-specific



Identifiers (Definitions of variables, methods, class names, package names)

Define rules: 1. Consist of letters, numbers, underscores, and $, but cannot start with a number

2. Cannot be a keyword in Java

Principles of definition: legibility, words too literally



Variable

The essence is a piece of memory area

Three elements: type, name, scope

Type determines the size of its storage area

Rule: 1. Variable must have a definite type

2. Variables must be declared and initialized before they can be used

3. Variable can be assigned value change

4. Variable has a definite scope, leaving the scope for immediate recycling

5. In the same scope, variables cannot be defined repeatedly

If you violate the above rules, a compilation error will occur.



Process Control with C language

If Else

For loop

While

Do While





8 Basic data types


4 Kinds of plastic:

Byte 1 bytes

Short 2 bytes

int 4 bytes

Long8 bytes

2 types of floating-point type

Float4 bytes

Double8 bytes

Boolean type

Boolean 1 bit

Character type

Char 2 bytes




Compound (Reference) type

objects, interfaces


Java Basic syntax

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.