Having confusion to understand a java question

I am trying to find the solution for below question, can someone help

Write a program that generates 60 pairs of random integers (int) with values between 1 and 10 000. For each generated pair, use an if-else statement to classify the first value as greater than, less than, or equal to the second value. For output, display BOTH generated values, as well as the classification, in the format “Number 1 < classification > Number 2”, one number pair per output line, where < classification > is one of the phrases “less than,” “equals,” or “greater than.”

I understand how I can use the if-else condition, but don’t understand the “generate 60 pairs of random integer”. I don’t need the solution just the explanation. Do I have to create 60 Arrays with every array only 2 random number can add it

You can just use a for loop and the Random class (part of the Java standard library) to generate the random numbers. Search for “Java 17 Random” to find the Javadoc for the Random class (or whatever version of Java you are using).

Java 19

so that means i need to create to for loop

//60 pairs
for(int i = 0; i <=60; i++){
//in one pair 2 numbers (0 and 1)
for(int j=0; j<2; j++){
// randomize the first number and then second number
}
}

The outer for loop has what we call an “off by one error” (either needs a different starting value or a different condition) and the inner loop is unnecessary. You can just use the Random object twice to produce two different random numbers.

Did you find the Javadoc for the Random class?

Javadoc for the Random class in Java 19: Random (Java SE 19 & JDK 19 [build 6])

You can use the default constructor and check out the nextInt method.

Can you please a simple example

Sure. This is how to get a random number between 1 and 10.

var random = new Random();

var betweenOneAndTen = random.nextInt(10) + 1;