回答編集履歴

3

訂正3

2016/11/14 10:59

投稿

退会済みユーザー
test CHANGED
@@ -88,13 +88,13 @@
88
88
 
89
89
 
90
90
 
91
- public Dice(Object obj){ // コンストラクタ
91
+ public Dice(Object ...obj){ // コンストラクタ
92
92
 
93
93
  for(int i = 0; i < 6; i++){
94
94
 
95
- if(obj instanceof int[]){
95
+ if(obj[0] instanceof int[]){
96
-
96
+
97
- int[] d = (int[]) obj;
97
+ int[] d = (int[]) obj[0];
98
98
 
99
99
  _d[i] = d[i];
100
100
 

2

訂正2

2016/11/14 10:59

投稿

退会済みユーザー
test CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  int n = scan.nextInt();
26
26
 
27
- Integer[] d = new Integer[6];
27
+ int[] d = new int[6];
28
28
 
29
29
  Dice[] dices = new Dice[n];
30
30
 
@@ -40,9 +40,9 @@
40
40
 
41
41
  }
42
42
 
43
- Object[] objs = (Object[]) d;
43
+ Object objs = d;
44
-
44
+
45
- dices[i] = new Dice((Object[]) objs);
45
+ dices[i] = new Dice((Object) objs);
46
46
 
47
47
  }
48
48
 
@@ -88,21 +88,13 @@
88
88
 
89
89
 
90
90
 
91
- public Dice(Object... obj){ // コンストラクタ
91
+ public Dice(Object obj){ // コンストラクタ
92
-
93
- Integer c[]=new Integer[6];
94
92
 
95
93
  for(int i = 0; i < 6; i++){
96
94
 
97
-
98
-
99
- System.out.println(obj.getClass());
100
-
101
- if(obj instanceof Integer[]){
95
+ if(obj instanceof int[]){
102
-
103
-
104
-
96
+
105
- Integer[] d = (Integer[])obj;
97
+ int[] d = (int[]) obj;
106
98
 
107
99
  _d[i] = d[i];
108
100
 

1

訂正

2016/11/14 10:55

投稿

退会済みユーザー
test CHANGED
@@ -100,7 +100,7 @@
100
100
 
101
101
  if(obj instanceof Integer[]){
102
102
 
103
- System.out.println("qwe");
103
+
104
104
 
105
105
  Integer[] d = (Integer[])obj;
106
106