Replace elements in 2d array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Replace elements in 2d array

in java: how do i replace an element in a 2d array. im trying to just reassign but it doesnt seem to be working. maybe its just another part of my code thats not correct but im not sure. can someone help please Its a char array in case that helps Link: repl.it/@noup/arraysTICTAC

27th Oct 2019, 7:38 PM
RA Mines
RA Mines - avatar
2 Answers
+ 1
int[][] myarr = {{1,2,3},{4,5,6}}; // now change the 3 to 10 myarr[0][2] = 10; // now change the 5 to 10 myarr[1][1] = 10;
27th Oct 2019, 11:53 PM
rodwynnejones
rodwynnejones - avatar
+ 1
Link: repl.it/@noup/arraysTICTAC
27th Oct 2019, 11:57 PM
RA Mines
RA Mines - avatar