How to generate Random Numbers in JAVA using FOR LOOP (in HINDI) || Java Programming Tutorials

Опубликовано: 18 Май 2026
на канале: Learning and Teaching Coding
2,241
58

For using Random class to generate random numbers, we have to first create an instance of this class and then invoke methods such as nextInt(), nextDouble(), nextLong() etc using that instance. Like we use "rnum" instance variable.

We can generate random numbers of types integers, float, double, long, booleans using this class.

We can pass arguments to the methods for placing an upper bound on the range of the numbers to be generated. For example, nextInt(200) will generate numbers in the range 0 to 200 both inclusive.

#LearningandTeachingCoding
#JavaProgrammingTutorials
#JavaPrograms