Generate random numbers using Java! 🔀

Published: 05 December 2024
on channel: Bro Code
48,487
839

#java #javatutorial #javacourse

import java.util.Random;

public class Main {
public static void main(String[] args) {

Random random = new Random();

int number;
boolean isHeads;

number = random.nextInt(1, 7);

isHeads = random.nextBoolean();

System.out.println(number);

if(isHeads){
System.out.println("HEADS");
}
else{
System.out.println("TAILS");
}
}
}


On this page of the site you can watch the video online Generate random numbers using Java! 🔀 with a duration of online in good quality, which was uploaded by the user Bro Code 05 December 2024, share the link with friends and acquaintances, this video has already been watched 48,487 times on youtube and it was liked by 839 viewers. Enjoy your viewing!