jeudi 13 juillet 2017

Random.nextInt "can't resolve symbol"

I have the following code:

   import java.util.*;

   public class Random{

     public static void main( String args[] ){
     // create random object
     Random randomno = new Random();

     // check next int value  
     System.out.println(randomno.nextInt(20));
   }    
}

I get the following message:

Random.java:9: error: cannot find symbol
   System.out.println(randomno.nextInt(20));
                              ^
  symbol:   method nextInt(int)
  location: variable randomno of type Random
1 error

I have Java "1.8.0_101" version.

This same code seems to work in the tutorials point sandbox JVM.

Thanks in advance for your time!




Aucun commentaire:

Enregistrer un commentaire