int a = random.nextInt(7) + 4;

a) Random number between 4 to 7, including 4 and 7

b) Random number between 4 to 7, excluding 4 and 7

c) Random number between 4 to 10, excluding 4 and 10

d) Random number between 4 to 10, including 4 and 10

int a = random.nextInt(7) + 4;

a) Random number between 4 to 7, including 4 and 7

b) Random number between 4 to 7, excluding 4 and 7

c) Random number between 4 to 10, excluding 4 and 10

d) Random number between 4 to 10, including 4 and 10

You must be logged in to post a comment.

d

Explanation: random.nextInd(7) + 4; returns random numbers between 4 to 10 including 4 and 10. it follows “nextInt(max – min +1) + min” formula.