摘要: 变量 实例变量如果不自行初始化,则调用默认值。 数据类型 默认值 int 0 double 0.0 string null bool false public class HelloWorld { //常量:final 修饰符 不存在先后顺序 final static double PI = 3.1 阅读全文
posted @ 2021-08-13 19:33 博客用户66 阅读(45) 评论(0) 推荐(0)
摘要: 1.强制转换:(类型)变量名 高->低 2.自动转换 低->高 int i = 128; byte b = (byte) i; //强制转换 byte范围最大127 内存溢出 double c = i; //自动转换 System.out.println(i); //输出128 System.out 阅读全文
posted @ 2021-08-13 16:04 博客用户66 阅读(36) 评论(0) 推荐(0)
摘要: Java是强类型语言 整数:long类型要在数字后面加个L long num1 = 30L; int num2 = 30; byte num3 = 30; short num4 = 30; 拓展 int i = 10; int i2 = 010;//八进制o int i3 = 0x11;//十六进制 阅读全文
posted @ 2021-08-13 14:57 博客用户66 阅读(63) 评论(0) 推荐(0)