Jonathan GrieveTreehouse Moderator 83,943 Points
What's the (n: 3) in the nextInt() parameter?
Can I ask, what the n: refers to in the nextInt() method?
I understand were just passing an integer parameter to give the range of numbers to be returned but my Android studio doesn't come up with this when I pass it in.
It is a parameter name hint, if you look at the documentation for the
nextInt method you can see that
n is the parameter name used by that method.
It is a feature found in most IntelliJ based IDEs. Whether it is enabled by default or not seems to change from version to version. If you want to enable it you can open the settings window then go to Editor -> General -> Appearance and check "Show parameter name hints".
The IDE tries to hide the hint if the parameter is likely to be obvious, so by default it won't show up on all method calls even with that option enabled, but that behavior can be configured.