lundi 11 septembre 2023

I created an object of Randon class in java , But when invoking nextInt() method using the object it's giving cannot find symbol error [duplicate]

java.util.Random ran = new java.util.Random();

int target_number = ran.nexInt(10);





 D:\CODING\JAVA\JAVA FILES>javac Gamelauncher.java
    Gamelauncher.java:21: error: cannot find symbol
                target_number = ran.nexInt(10);
                                   ^
    symbol:   method nexInt(int)
    location: variable ran of type Random
    1 error

i was trying to generate a random number under 10 and store it to a integer variable target_number but giving cant find symbol error




Aucun commentaire:

Enregistrer un commentaire