2. Data Types in Java are classified into two categories:
1) primitive data type)
2) Reference Type)
3. Variables and constants: the so-called constants, that is, the amount of values that do not change; the so-called variables, that is, the values can change
.
4. How to define variables?
Variable name;
Int;
5. How to assign values to variables?
Variable name = variable value;
A = 2;
= Indicates a value assignment. The value on the right of the equal sign is assigned to the variable on the left.
In Java, = is equivalent to = in mathematics.
6. Define and assign values to variables.
Variable name;
Variable name = variable value;
Int;
A = 1;
You can combine the above two steps into one:
Variable type variable name = variable value;
Int A = 1;
7. variable name: in Java, the variable name starts with an underscore, a letter, and a $ symbol, followed by an underscore,
Letters, $ characters, and numbers. In short, the variable name in Java cannot start with a number.
There are eight native Data Types in Java:
1) Integer type: int type. (32-bit)
2) byte: byte. (-128 ~ 127 integers between 256 ). 3) Short INTEGER: represented by short. (16 bits)
4) Long Integer: Long is used. (64-bit)
8. Data Representation in computer systems
Bit: Bit (only in the 0, 1 states), which is the smallest Data Representation Unit in the computer system.
Bytes: byte, 1 byte = 8 bit.
1 kb = 1024 bytes (1Kg = 1000 GB, different from the computer system)
1 MB = 1024 KB
1 GB = 1024 MB
9. comment. Annotations are for people, not for computers. Java has three types of Annotations:
1) single line comment: starts with //, and all the content following // is treated as comment.
2) multi-line comment: starts with/* and ends with */. All content in the middle is treated as comment. Multi-line comment comes from
C/C ++. Note that multi-line comments cannot be nested.
3) another multi-line comment. Used to generate the Java Doc help document. This document is not for the time being.
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