2013年7月10日

java原生类型大小

摘要: package frank;public class App{ public static void main(String[] args) { //Java基本类型的大小 /* 1个字节 = 8 bit byte = 1 个字节 char = 2个字节 short = 2个字节 int = 4个字节 long = 8个字节 float = 4个字节 double = 8个自己 boolean = 1个bit位 */ }} 阅读全文

posted @ 2013-07-10 22:39 wp456 阅读(189) 评论(0) 推荐(0)

java 7 新增数值类型写法

摘要: package frank;public class App{ public static void main(String[] args) { //java 7新增的写法 int binVal = 0B1000_0000_0000_0000_0000_0000_0000_0011; double pi = 3.14_15_92; int a = 8_5_1; float b = 3_2.5_4F; System.out.println(binVal); System.out.println(pi); }} 阅读全文

posted @ 2013-07-10 22:22 wp456 阅读(201) 评论(0) 推荐(0)

无穷大和非数

摘要: package frank;public class App{ public static void main(String[] args) { /* 除数不能为0, int a = 2; int b = 0; System.out.println(a/b);//编译通过,但是运行报错,by zero */ /* float a = 1.00F; float b = 0;//会自动变成浮点数的0.0 float c = a/b;//正无穷大 如果是一个负数除以0那就是负无穷大 float d = Float.NEGATIVE_INFINITY; System.out.pr... 阅读全文

posted @ 2013-07-10 22:13 wp456 阅读(450) 评论(0) 推荐(0)

导航