视频
笔记
public class Demo03Var{ public static void main(String[] args){ //byte byte num1 = 100; System.out.println(num1); //short short num2 = 1000; num2 = 1001; System.out.println(num2); //int 整数的默认类型 int num3 = 10000; num3 = 1; System.out.println(num3); //long -> 定义long型的变量后面加个L long num4 = 10L; System.out.println(num4); //float -> 定义float型变量的时候后面加个F float num5 = 2.5F; System.out.println(num5); //double -> 小数的默认类型 double num6 = 2.5; System.out.println(num6); //char char num7 = 'A'; System.out.println(num7); //boolean boolean num8 = true; boolean num9 = false; /* num9 = false num8 = num9 -> 将num9的值赋值给num8 -> 相当于num8 = false */ num8 = num9; System.out.println(num8); //String -> 是一个引用数据类型,属于类的一种,但是定义和基本类型一致 String name = "金莲"; System.out.println(name); } }