package com.bbs2018.basic; public class Demo01 { public static void main(String[] args) { //Java中的八种基本数据类型 //1、整型 int a = 12; int b; b = 19; int c = a + b; System.out.println(c); byte b1 = 23; System.out.println(b1); short s1 = 56; System.out.println(s1); long l1 = 109; System.out.println(l1); //2、浮点型 float f1 = (float) 2.3; System.out.println(f1); double d1 = 3.7; System.out.println(d1); //3、字符型 char c1 = 'a'; System.out.println(c1); //4、布尔型 boolean bool1 = true; boolean bool2 = false; System.out.println(bool1); System.out.println(bool2); System.out.println(a); } }
输出结果:
31 23 56 109 2.3 3.7 a true false 12