Java core technology variables, constants, operators

Source: Internet
Author: User
Tags arithmetic operators alphanumeric characters

In Java, every variable, constant is a type.

variables :

Example: int i;

Double A;

1 The variable name must be a sequence of alphanumeric characters beginning with a letter. But unlike most programming languages, the range of letters and numbers in Java is larger, and the letters include ' a ' ~ ' Z ', ' a ' ~ ' Z ', ' _ ' or any Unicode character that represents a letter in any language, such as Chinese: declaring String \u4f55\u660a\u9633 ; Initialize \u4f55\u660a\u9633= "He Haoyuan Yang", or string he Haoyuan Yang; he haoyuan Yang = "he Haoyuan Yang";

2 initialization is a good practice when declaring, never use uninitialized variables.

3 variables are divided into local variables and global variables

Constants : Example: Final double nasna=2.12212;

A 1 final modified variable is called a constant, which can only be assigned once, once the assignment cannot be changed.

2 customary constant names to capitalize

The constants of 3 static modifiers are called Class constants and can be common in a class. If declared as public can be used by other classes such as: Static final String sdnaksnd= "class constant";

Note: Class constants are declared outside the method, and only local constants can be declared within a method.

operator :

Category: 1 arithmetic operators +-*/%

2 self-increment self-decrement operator + +--

3 Relational operators > < >= <= = =! = Three mesh operator:? :

4 logical Operators && | | !

5-bit Operators & | ^ ~ >> << >>>




Java core technology variables, constants, 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.