📜  尝试在空对象引用上调用虚拟方法“int java.util.Random.nextInt(int)” - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:40.858000             🧑  作者: Mango

代码示例1
the problem: java.lang.NullPointerException: Attempt to invoke virtual method
'int java.util.Random.nextInt(int)' on a null object reference 
//you might do not code that:
Random rand = new Random();