What's rand.nextInt(3) ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's rand.nextInt(3) ?

I hope that I will make you people laugh, because I'm asking such a question. I have no clue what that means...?

23rd Apr 2019, 10:40 AM
BrandnameOra
BrandnameOra - avatar
2 Answers
+ 1
There is a class in Java library which provides a 'nextInt' method these method returns a int number. In this case an number between 0 and 2. So rand is the object reverence of these class and with .nextInt(3) you call the method.
23rd Apr 2019, 10:56 AM
Maximilian Hümmer
0
Maximilian Hümmer Hey, could you please give me an example of this? I want to understand this
23rd Apr 2019, 5:12 PM
BrandnameOra
BrandnameOra - avatar