System.out.println(var);
int i = 100;//整形值
System.out.println(i);
//整数类型 即没有小数部分的数值 有 byte short i n t long 内存占用一次为 1 2 4 8 (字节),1个字节== 8位内存空间
byte xc = 122,bx; //byte 整形数中分配内存空间最少的。占一字节. 所表示的值的范围为-128-127
bx = 123;
int gc = bx + xc;// int 为 2 32次方 取值范围很大 用的最广泛。
long zx;// 超出了int 就用long 一般也很少用、。。。
zx = 55555l;//在对long类型赋值的时候在变量结尾必须加上l或L 。否则将不被认为是long型 。。最好用 L l会与1混了
System.out.println(zx);
System.out.println(gc);
System.out.println(xc);
byte mybyte = 124;
short myshort = 32564;
int myint = 45784612;
long mylong = 44777777L;
long result = mybyte+ myshort +myint + mylong;
System.out.println("四种类型相加后的结果是:"+result);// +类似于oc中的%@.
float f1 = 13.32f;//想定义成float类型的话 必须在其末尾加上f,F 否则系统默认为、double类型 float 4 个字节32位内存空间
double d1 = 4563.3d;//双精度浮点型
double dresult = f1 + d1;
System.out.println("dresult ==="+dresult);//中间没有逗号
char c = 's';//字符类型 单引号.俩个字节的内存空间
//char x = 97;// 97 为a
char xc = 65; //65 为A
System.out.println("c=="+c);
System.out.print("xc==="+xc);
char char1 = '\\';
char char2 = '\u2605';
System.out.print(char1);
System.out.print(char2);
boolean thistrue = true;
boolean thisfalse = false;
//常量 变量
int age ;//声明整形变量
char ss = 's';//声明字符型变量. 系统的 内存大致可分为三个区域 。即系统区。程序区。数据区 当程序代码执行时 会加载到内存中的程序区,数据区暂存放数据
age = 10;
System.out.println("i现在的值是:"+age);
age = 111;
System.out.println("i现在的值是:"+age);
final double pi = 3.1415926d;
final boolean bool = true ;//声明常量 在整个程序中只被赋值一次。
System.out.println("常量double的值:" +bool);//变量的有效范围是值代码中能够访问该变量的区域. 分全局 ,局部