Author | Message |
---|---|
Anonymous
Posts: 166
|
Posted 18:25 Mar 04, 2014 |
can anyone tell me why this method does not compile, the error says incompatible types and also highlights the parenthesis, but that is what the instructions tell us to do. also what is the String toString method supposed to do. is it supposed to return the game board(animations) public int[] getFirstMoves() { |
kknaur
Posts: 540
|
Posted 18:47 Mar 04, 2014 |
I see two semicolons on the end, is that it? |
Eric Liao
Posts: 158
|
Posted 18:51 Mar 04, 2014 |
2 semicolons is fine. What you are missing is that I changed first_moves and second_moves as different types, which is not String anymore. You have to change it to List of integer in order to make it to compile. In other word, check the detail of the skeleton code.
|
Anonymous
Posts: 166
|
Posted 19:33 Mar 04, 2014 |
sorry about the two semicolons. I have this instance variables private List<Integer> first_moves; |
Eric Liao
Posts: 158
|
Posted 20:06 Mar 04, 2014 |
Sorry, I just found out that Java is not capable convert List of integer to array of integer by it's method toArray() from [this post]. So I fixed my template code to do convert using loop now. Please check the description again. |
rabbott
Posts: 1649
|
Posted 22:15 Mar 04, 2014 |
We should switch to Scala
|
Eric Liao
Posts: 158
|
Posted 23:01 Mar 04, 2014 |
I would prefer Python more! list = [1, 2 ,3] done! There is no difference between array and list :D Essentially, everything is like list if you define the item with [] |