Non-professional Code farmer Java Learning Note 2 Java language basics

Source: Internet
Author: User

Java Language Basics

(i) Procedural composition

Slightly

(ii) Data type variables and constants

1. Data type (similar to C #)

boolean bool 8 bit

BYTE 8-128-127

Character Char 16

Short-integer 16

Int 32

Long 64

Float 32

Double 64

2. Identifier-Variable constant method object and class name tag

Alphanumeric also has two special symbols _ and $

Letter underline or dollar sign start

3. Constants

4. Variables

(c) Expressions

1. Assignment and coercion type conversions

Tostring () weak conversion

Type = (type) variable: The value of a= (int) B;a is forcibly converted to int\ b

2. String connection

General is the + number, indicating the connection, as well as + = This column of the combination of symbols, etc.

3. Arithmetic Operation +-*/

4. Relational operations: = = = = = < > etc.

5. Logical operation, relatively complex

& with | or! Take the reverse; | | This type of coincident, right-hand expression may not be executed

6. Bitwise OPERATION: binary unit position >>,<< ~ (binary inverse value),>>> right shift not enough to fill 0

7. When other:b>a?a:b; are mixed, use () can be performed preferentially

8. Priority of operation: strong-Weak

.  [] () ~!++--*/+->> <>=! = &|  &&| | ?: = (assigned value)

9. Notes

//  /**/

(iv) Process Control statements

1. Branch statements

If (A>B)

A

Else

B

Swith (variable, expression)/* differs from C # in case not break;*/

Case value, operation result: statement 1; .... ; default: statement;

2. Looping statements

while (n<10000)

{Executed statement;}

Do

{Executed statement;}

while{conditions of cessation;}

3. Jump statements

Continue:

First-loop:

Execute the statement;

If (condition)

{Continue first-loop;}

Break statement: Only valid if you want to put it in a loop statement

Return statement: Returns, can be followed with parameters, programs, etc., without representing no return value, terminating execution

Non-professional Code farmer Java Learning Note 2 Java language basics

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.