- 原生(primitive)类型(基础类型) --- 四类八种
- 整数
- byte
- short
- int
- long
- 浮点数(小数)
- float
- double
- 布尔
- boolean
- 字符
- char
- 整数
- 引用(reference)类型(对象类型)
- 除原生类型之外都是引用类型
原生类型的包装类
package com.gongxy.demo;
/**
* 包装类
* byte[Byte]
* short[Short]
* int[Integer]
* long[Long]
* float[Float]
* double[Double]
* boolean[Boolean]
* char[Character]
*/
public class MyTest {
public static void main(String[] args) {
String s = "12a";//java.lang.NumberFormatException
s = null;//java.lang.NumberFormatException: null
s = "12.12";//java.lang.NumberFormatException
s = "12";
int a = Integer.parseInt(s);
System.out.println(a);
System.out.println("Max:" + Integer.MAX_VALUE);
System.out.println("Mix:" + Integer.MIN_VALUE);
System.out.println("Size:" + Integer.SIZE);
//Byte
//Short
//Integer
//Long
//Float
//Double
//Boolean
//Character
}
}