package com.sf.day01; import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer; import java.sql.SQLOutput; /** * 1 - 在day01包下创建一个类 类名Test01 * 2 - 当前类 class * 3 - public 公共的 公开的 - 权限修饰符中的一种 * 4 - Student 标识符 * 标识符和关键字不同 : * 关键字 - Java给我们定义好的 我们不能用关键字作为标识符 * 标识符: 凡是自己起名字的都可以称之为标识符 * 见名知意 - 好记 getInfo() updateUserByUserId(); -- yVoid * com.sf.day01 包名 通常 包名定义 : 公司域名的倒叙 * www.baidu.com -- 域名 196.168.xx.xx ip * 47.96.190.116 -- www.guyanqing.com * Student 类名 */ public class Test01 { String name = "zhangdan"; public static void main(String[] args) { int a = 1; //初始化 // System.out.println(a); a = 2; System.out.println(a); int b ; //声明 b = 18; //赋值 System.out.println(b); int d = 20; int e = 0; //没有赋值 int 的默认值是 0 System.out.println(d); System.out.println(e); System.out.println("==============================="); /** * 基本数据类型 * byte short int long 整型 * float double 浮点类型 * char 字符类型 * Boolean 布尔类型 true false * 规范 long L */ byte aa = 1; short bb = 2; int cc = 3; long dd = 4L; /** * 浮点数据类型 */ float ee = 5.0F; /* double Double的区别: int 0 double 0.0 Double 默认值 null 选择: 用double作为一个接受的变量(非0.0) double/Double 映射实体的时候 Double 默认值 null eg: double aa = 0.0; aa = 0.0; int bb ; bb = 1; 1 sout bb ; // 0 Double / Integer null 0; */ double ff = 6.0D; //基本数据类型 Double gg = 7.0D; //类 double的包装类 自动拆装箱 char hh = 'A'; //A 65 a 97 String jj = "AA"; int qq = 1; char ww = 'A'; //65 System.out.println(ww+qq); char qqq = (char) (66); System.out.println(qqq); boolean rr = true; boolean yy = false; // ctrl + d int zz = 5; float zzz = 5; //5 int float long ll = 112; // 小转大 自动转换 ll = zz; // 大转小 强转 zz = (int) ll; } }