java基础数据类型
数据类型:
一、基本数据类型:(byte,int,short,long)整数类型,(float,double)浮点类型,boolean,char
long类型的数据类型后面必须加L
long lo=30L;
float类型中数据类型后面必须加F
float num=50.1F;
二、引用数据类型:String , 数组,类,接口
String s1 = new String("helloworld");
String s2 = new String("helloworld");
System.out.println(s1==s2);// false
String s3 = "helloworld";
String s4 = "helloworld";
System.out.println(s3 == s4);// true
三、常量定义使用final 修饰符位置可以任意
四、一元运算
int a=3;
int b=a++;
int c=++a;
System.out.println(a);//5
System.out.println(b);//3
System.out.println(c);//5
int a=3;
int b=a--;
int c=--a;
System.out.println(a);//1
System.out.println(b);//3
System.out.println(c);//1