mirror of https://github.com/Black-Gold/Learn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
485 B
32 lines
485 B
public class Jb02_VarDemo1
|
|
{
|
|
public static void main(String[] args)
|
|
{
|
|
/*
|
|
byte 1字节
|
|
boolean 1字节
|
|
short 2字节
|
|
char 2字节
|
|
int 4字节
|
|
float 4字节
|
|
long 8字节
|
|
double 8字节
|
|
*/
|
|
//数据类型 变量名 = 初始化值;
|
|
byte b = 1; //定义变量b,初始化值为1
|
|
short s = 2;
|
|
int i = 3;
|
|
long l = 4;
|
|
float f = 5.5f;
|
|
double d = 6.6;
|
|
char c = 'c';
|
|
boolean bo = true;
|
|
bo = false;
|
|
{
|
|
int x = 9;
|
|
System.out.println("x"); //局部变量x
|
|
}
|
|
System.out.println(c);
|
|
}
|
|
}
|