0% found this document useful (0 votes)
3 views1 page

Java Tutorials

The document provides an example of generating random numbers in Java using the `java.util.Random` class. It demonstrates how to create a Random object and generate a random integer within a specified range (1 to 100). The generated random number is then printed to the console.

Uploaded by

Christian
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Java Tutorials

The document provides an example of generating random numbers in Java using the `java.util.Random` class. It demonstrates how to create a Random object and generate a random integer within a specified range (1 to 100). The generated random number is then printed to the console.

Uploaded by

Christian
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

In Java, you can generate random numbers using the `[Link]` class.

Example:

import [Link];

public class RandomNumber {


public static void main(String[] args) {
// Creating a Random object
Random random = new Random();

// Generating a random integer within a specific range


// (e.g., 1 to 100)
int min = 1;
int max = 100;
int randomInRange = [Link](max - min + 1) + min;

[Link]("Random Number in Range: " +


randomInRange);

}
}

You might also like