0

2 dimensional array and printing the randomly picked string - Java

Hi guys! I have a 2 dimensional array which I have gotten the computer to randomly a select an element from. The issue is I can't seem to print out the single element that was randomly selected? It print out something like "A1" or "B2" or something like that. https://code.sololearn.com/cBx1rHRtg9Sa/#java

6th Sep 2017, 6:27 PM
YodaCoda
YodaCoda - avatar
3 odpowiedzi
+ 3
Remember the first dimension of a 2d array is always another array. Printing out an Object (in this case, the array) will give you the className+'@'+hex(hashcode()). System.out.println(myArray[index]); // Some array System.out.println(myArray[index1][index2]); // The element at index2 of the array at index1
7th Sep 2017, 2:59 AM
Rrestoring faith
Rrestoring faith - avatar
+ 6
Just like the row value has been generated, the column value also must be generated for 2D array. There were other minor bugs too. Hope it helps :) https://code.sololearn.com/c9D9SJCsAV0M/?ref=app
6th Sep 2017, 7:23 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 1
you sir, are amazing thank you.
7th Sep 2017, 12:02 PM
YodaCoda
YodaCoda - avatar