Java annotations
- Single-line comments // (comment only line of text)
- Multi-line comments / ** / (Enter the text between two asterisks, you can annotate a text)
- Documentation comments / ** (two asterisks in front, followed by an asterisk, you can enter text in between them)
* /
Identifier
All components of Java requires name, class names, variable names and method names are called identifiers.
important point
- All identifiers should be in uppercase or lowercase letters (AZ or az), the dollar sign ($), or an underscore (_) begins.
- After the first letter can be uppercase or lowercase letters (AZ or az), the dollar sign ($), or an underscore (_) characters, or any combination of numbers.
- You can not use keywords as variable or method name.
- Identifiers are case sensitive
- Legal identifier, for example: age, $ salary, _value, _ _1_value
- Illegal identifier example: 123abc, -salary, # abc
- Or you can use Chinese pinyin name, but is not recommended
type of data
-
Strongly typed language
requires the use of variables to strictly comply with the provisions, in order to use all the variables must be defined -
Weakly typed language
Java belong to a strongly typed language
- java data types into two categories
- Basic types of
bits (bit) is the smallest unit of computer storage.
Byte (byte) is generally expressed by the capital letter B
characters: refer to a computer with letters, numbers, characters, symbols.
1B=8b
1024B=1KB
1024KB=1M
1024M=1G
1024G=1TB
-
Note that
long after the digital input to the L +
float to its input after the decimal F +
String is not a keyword -
Reference types