type of data
Strongly typed language
requires the use of variables to strictly comply with regulations, and all variables must be defined before they can be used
Java data types are divided into two categories
Primitive type
//四个整数类型
int num1 = 999;
//int 占四个字节范围
//int 最常用9
byte num2 = 9;
//byte 占一个字节范围 -128到127
short num3 = 99;
long num4 = 99999L;// long类型要在数字后面加L(大写)
//小数 浮点数:
float num5 = 9.9F;// float类型要在数字后面加F
double num6 = 9.99;//常用
//字符(字符代表的是一个字,两个字就不是了,两个字是字符串)
char name = '瓜';// 用这个'‘引号 占2个字节
//字符串
//Sting不是关键字,是类
//布尔值 (是,非)
boolean summer = true;
boolean winter = false;
Reference data type (reference type)
What is byte
Bit (bit) The smallest unit of internal data storage. 11001100 is an eight-bit binary
byte (byte) basic unit of data processing. It is customary to use capital B to represent
1B (byte, byte) = 8bit (bit)
character: Yes Refers to letters, numbers, words and symbols used in computers
1bit means 1 bit,
1Byte means a byte 1B=8b
1024B=1KB
1024KB=1M
1024M=1G
1024G=1T