Random.nextInt(5) throws an IllegalArgumentException!!??

Posted by Tom R on Stack Overflow See other posts from Stack Overflow or by Tom R
Published on 2010-04-25T20:43:44Z Indexed on 2010/04/25 20:53 UTC
Read the original article Hit count: 155

Filed under:
|
|

I'm really not sure what else to say about this:

Random r = new Random();

class SomeClass {
   public SomeClass(){
       new SomeClass(r.nextInt(5));
   }

   public SomeClass(int i){
   ...

Throws a NullPointerException where r.nextInt(5) is called. Any ideas?

© Stack Overflow or respective owner

Related posts about java

Related posts about android