Write a program to generate random numbers in java.
Example: Using the random class in java
Approach
Java
import java.util.Random;public class Main{public static void main(String[] args) {Random random = new Random();System.out.println("random integet:"+random.nextInt());//random doublerandom.nextDouble();//random booleanrandom.nextBoolean();}
No comments:
Post a Comment