Java编码规范-字符串与Integer的比较,BigDecimal非空参数
package com.example.core.mydemo; import java.math.BigDecimal; public class IntTest { public static void main(String[] args) { Integer type = 2; // if("2".equals(type)) { if(type == 2) { System.out.println("type=" + type); }else{ System.out.println("111"); } /** * 报空了: * ss=null * Exception in thread "main" java.lang.NullPointerException * at com.example.core.mydemo.IntTest.main(IntTest.java:17) */ Integer ss = null; System.out.println("ss=" + ss); BigDecimal g = new BigDecimal(ss); System.out.println("g="+ g); } }
标签:非空,Java,BigDecimal,ss,System,Integer,type,out From: https://www.cnblogs.com/oktokeep/p/17342699.html