javase笔记日更
public class demo01 {
public static void main(String[] args) {
int i =10;
int i1=010;
int i2=0x10;
System.out.println(i);
System.out.println(i1); //八进制
System.out.println(i2); //十六进制
//================================================================
//浮点数的拓展?
//================================================================
System.out.println("==========================================");
float f =0.1f;
double d=1.0/10;
System.out.println(f==d);// 同样是得0.1,这里布尔值却是false
System.out.println(f);
System.out.println(d);
System.out.println("==========================================");
char c1 ='中';
char c2 = 'a';
System.out.println(c1);
System.out.println((int)c1); //强制转换
System.out.println(c2);
System.out.println((int)c2); //强制转换
//转义字符
//\t
//..........
System.out.println("hello\tworld"); //加个空格
System.out.println("hello\nworld"); //换行
System.out.println("==========================================");
//思考:为什么下列两个hello world值是不相等的
String sa =new String("hello world");
String sb =new String("hello world");
System.out.println(sa==sb);
String sc ="hello world";
String sd ="hello world";
System.out.println(sc==sd);
}
}
运行结果: