请注意,如果将引用类型为空的包装类型的数据传递给基本数据类型的,则在转换期间会发生空指针异常。 建议在转换前进行判断,或者使用一致的类型。 这个问题是基础性的,但容易犯错误
integer max=空; 搜索(max; system.out.println(ok ); 源代码中说明了直接清空指针异常
publicstaticintparseint (strings, int radix (throwsnumberformatexception (/* * warning : thismethodmaybeinvokedearlyduringvminitialization * ) beforeintegercacheisinitialized.caremustbetakentonotuse * thevalueofmethod.*/if (s==null ) thrownewnumberformatexccccccod
publicstaticvoidsearch(intnum ) { return; }
exceptioninthread ' main ' Java.lang.nullpointerexception
atcom.unique.user.main (user.Java :34 ) )。