Get Whole Numbers
You can use it to get random integers too:
int num = (int)(Math.random() * 10); // 0 to 9
Mini Challenge: Dice Game
Write a program that:
-
Rolls two dice
-
Adds them together
-
Prints “You rolled: X + Y = Z”
When I first heard of Java, I thought it was just something to do with Minecraft mods or Android apps. I didn’t realize it would become my...
No comments:
Post a Comment