-
What would be the output of following code snippet?
int ran = random.nextInt(10) + 1;
-
- Random number between 1 to 10, excluding 10
- Random number between 1 to 10, excluding 1 and 10
- Random number between 1 to 10, including 1 and 10
- Random number between 1 to 10, excluding 1
- None of these
Correct Option: C
random.nextInt(10) + 1; returns random numbers between 1 to 10 including 1 and 10.