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”
Tired of just printing "Hello World"? It’s time to build something real. 💻 If you're learning Java and want to stand out, ...
No comments:
Post a Comment