We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ece64d7 commit 9bfe182Copy full SHA for 9bfe182
1 file changed
Exercise.java
@@ -1,12 +1,20 @@
1
+import java.util.ArrayList;
2
+
3
public class Exercise {
4
5
public static void main(String[] args) {
- Dice dice = new Dice(1);
6
+ ArrayList<Dice> dices = new ArrayList<>();
7
8
+ for (int i = 1; i <= 5; i++) {
9
+ Dice dice = new Dice(i);
10
+ dices.add(dice);
11
+ }
12
- System.out.println("ID - Wuerfelwert");
- for (int i = 1; i <= 5; i++) {
- dice.rollTheDice();
- System.out.println(dice.getId() + " - " + dice.getValue());
- }
13
+ System.out.println("ID - Wuerfelwert");
14
+ for (int i = 0; i < dices.size(); i++) {
15
+ Dice dice = dices.get(i);
16
+ dice.rollTheDice();
17
+ System.out.println(dice.getId() + " - " + dice.getValue());
18
19
}
20
0 commit comments