Data types, variables, and operators

Source: Internet
Author: User

One. Data type

int shaping such as:, etc.;

Double dual precision floating point type such as: 2.3, 3.4, etc.;

string strings such as: "", "good", etc.;

Char character type such as: ' Number ', ' male ', etc.;

The Boolean Boolean type has only two values of--false/tyue;

Two. Variable

1. Variable definition: Allocate a space in the memory space to store the data;

2. Structure of variables: data type, variable name, value of variable;

3. Syntax for declaring variables: data type variable name; nit num;;

4. Syntax for assigning a variable: variable name = value; num=3;;

5. The syntax of the life variable and assignment: The data type variable name = value, such as: int num=3; ;

6. Naming conventions for variable names:

1. Variable names cannot contain Java keywords;

2. The variable name must begin with a letter, an underscore "_", "$";

3. Variable names can contain numbers but cannot start with numbers;

4. The first word of the variable name is lowercase followed by a special meaning of the first letter of the word capital;

5. The name of the variable names should be meaningful, as far as possible with a short English word name;

Three. Operators

1. Arithmetic operators

1.+ addition operator;

2.-subtraction operator;

3./rounding operator;

4.% the remainder operator;

5.* multiplication operator;

2. Relational operators

1.< indicates that one operand is less than the other;

2.< indicates that one operand is greater than the other operand;

3.<= indicates that one operand is less than or equal to another operand;

4.>= indicates that one operand is greater than or equal to another operand;

5.== indicates that one operand equals another operand;

3. Logical operators

1.&& logic and truth are true, the rest is false

2.| | The logic or the truth must be true, the rest is false

3.! = Logic is not true, its false is true

4. Assignment operators

The 1.= assignment operator assigns the value on the right side of the equal sign to the variable on the left

Data types, variables, and operators

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.