Generating random numbers in Java

Q1. Can you write Java code to generate random numbers between a given range? A1. E.g. 0 and 9 or 5 to 35, and so on.

The “nextInt()” method works from “0” onwards. So, “rand.nextInt(9)” will return 9 numbers…

🔥 300+ Java Interview FAQs

Java & Big Data Tutorials