Java: Types
Primitive types
- Primitive types: for storing simple values
- Refrences: for storing complex objects
Type | Bytes | Range |
---|---|---|
byte | 1 | [-128, 127] |
short | 2 | [-32k, 32k] |
int | 4 | [-2B, 2B] |
long | 8 | |
float | 4 | |
double | 8 | |
char | 2 | A, B, C, … |
boolean | 1 | true / false |
Reference types
- Primitive types: numbers, characters, booleans
- Refrences: data, mail message
1 | public class Main { |
primitive types 存储直接存储值
reference types 存储地址
Casting and Parse
1 | public class Main { |
Math
1 | public class Main { |
Formating numbers
1 | public class Main { |
Reading input
1 | public class Main { |
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment
Anonymous Comment
You don't need to delete empty lines. Comment directly for the best display effect.