Simple Java Dice Program #8

preview_player
Показать описание

In this video, I show you how to make a simple, rolling dice program in java! If you're looking for a java program example, you've come to the right place!

I like to take a break from learning and just making programs! That's why I made this simple java program for beginners, that I hope will help you learn-by-doing!

I hope you enjoyed this simple java program for beginners on creating your own rolling dice program! I really enjoy making videos like this so I'll probably do a lot more project tutorials like this one :)

On this channel I make new java tutorials every week for beginners and also easy java projects for beginners, so if that's something your into, consider subscribing!

What challenges did you face when making your rolling dice program? -

Disclosure: The Springboard link provided is linked to my affiliate account & supports the channel.

~

Alex Lee
Рекомендации по теме
Комментарии
Автор

Random diceNumb = new Random();
Int x = diceNumb.nextInt(6) + 1

Int x = diceNumb.nextInt( This number in the bracket is the limit of ) + *and the '+ 1' pushes the characters by 1 unit.
the numbers randomly generated. So instead of 0 - 5, it adds 1 unit up to the
The range is 0 - 5 because it counts lowest and highest limit . Making it 1 - 6.*
the characters starting from 0. So 0 - 5
is 6 characters.)

I tried my best to explain it so people that don't understad why the numbers are put in this way get an idea of how it works

Barhoom
Автор

You can also make an interactive dice rolling program like this:

Import java.util.Random;
Import java.util.Scanner;

public class Dice {

public static void main(String[] args) {
int numSides;
int roll;

Scanner scan = new Scanner(System.in);
Random rand = new Random();

System.out.println("How many sides?");
numSides = scan.nextInt();

roll = rand.nextInt(numSides) + 1;
System.out.println("You rolled a: " + roll);
}
}

I spent way too much figuring this out so here you go.

ultraminer
Автор

You deserve more credit, your tutorials are really good

lexi
Автор

The way you explain things is better than my teacher in college! Good job!

chronicallyVirgo
Автор

great work! this is how the beginners can be taught to love any programming language. keep it coming Alex

trueblue
Автор

Same question I’ve faced at the time of my job interview and I use to wrote multiple line program at that time ..

This is really a simple one and easy understanding..

Thanks .. Subscribed 👍🏻😇💡

pawansasane
Автор

i have an exam in a few days and ive missed a lot of classes, so im going through all your videos, thank you so much, they help me a lot!

greyay
Автор

I coded this. You could say this is my first program xD

You can enter the amount of rolls you want in the console and then you'll get the results.

package simpleJavaProgram;
import java.util.Random;
import java.util.Scanner;

public class DiceRolling {

public static void main(String[] args) {

Random dice = new Random();

Scanner input = new Scanner(System.in);
System.out.println("How often do you want to roll?");

int rolls = input.nextInt();

System.out.println("Rolling Dice...");




for(int i = 1; i <= rolls; i++) {
int int_random = dice.nextInt(6)+1;
rolled");

}
Scanner dontClose = new Scanner(System.in);
dontClose.nextLine();
}

}

linusziegler
Автор

I really liked this tutorial dawg. it was actually engaging and effective. my trouble was with syntax but what programmer doesn't have trouble with that when making a program. preciate it man

jamalbonheur
Автор

Your style is awesome. Keep up the good work.

augustoliver
Автор

You are really sympathic, good quality videos, keep up the good work buddy, it'll pay off!

ShowGameSupport
Автор

You deserve so much more subscribers ! This helped me a lot, I'm still a beginner, but yout tutorial was wayy more easrier than any I've seen !
Keep up the good work my brudda !

awesomevatsal
Автор

Honestly, I could just drop my compsci class and learn from this channel!

navneethoruganti
Автор

When u said "save it nd run it" I really like that part.

kakashihatake
Автор

I am from India
And I like this video this was very understandable
This was fabulous
You cleared it
Thank u very much

funwithprathibha
Автор

one of the best online programming teacher !!!!

hanzalamansoor
Автор

Thanks heaven i found your channel, specially this video, i was looking for videos like this because i'm getting stuck with java .
Thank u so much!

mariadc
Автор

Hi Lee, thank you for the wonderful lessons, it will be highly helpful for a beginner like me. I am started writing my java programs now.

sunnusvlogs
Автор

Thank you so much i am taking java but wanted to do some fun stuff with it and found YOU. Thank you so much keep up the good work.

The_Wandering_Warrior
Автор

You’re tutorials are so good, I could understand everything very easily thanks to you.

preranarajb