+ 1
The index to acces elements of this multidimensional array doesn t make sense to me
it s nothing like what s in the lesson before it seems conflicting to me https://www.sololearn.com/learn/Java/2149/
14 Respostas
+ 8
Using two indexes works like this:
sample is an array with 2 elements: {1, 2, 3}, and {4, 5, 6}.
The first index selects which array in sample you're accessing.
Ex: sample[0] selects {1, 2, 3}
The second index selects the element from the array you just chose.
Ex: sample [0][1] selects 2 from {1, 2, 3}
+ 8
omg I'm sorry I didn't notice what you were asking! (I think I'm just tired lol). This is something lots of people get stuck on, so I kinda jumped to conclusions.
The example demonstrates setting values to elements, and getting them.
The first line (that you showed) shows how to assign a new value to an element.
The other line shows how to get a value out of the array.
I think what was confusing is that one is an assignment:
myArr[0][1] = 42;
and the other has a comment saying what it contains:
int x = myArr[1][0]; //4
+ 8
Check your spam first.
Ifyou didn't get an email, go to the ... menu in the corner > Settings > Edit Profile and change your email to something else and back to the one you want. It'll resend.
Have fun here! <3 And sorry I wasn't being helpful with your question lol
+ 7
Oh, sorry!
This line from the lesson example replaces 3 in {1, 2, 3} with 42:
myArr[0][2] = 42;
The result is that myArr[0] becomes {1, 2, 42}.
+ 2
it s not the first page it s clear it the second check again
+ 2
int myarr[ ] [ ]={1,2,3},{4},,{5,6,7};
myarr[0][1]=42
+ 2
ow lol that s simple
+ 2
let me check
+ 2
Tamara thanks i already know that i did from the start but that s not what i was looking for i guess the confusing detail i m asking about on the second page is something that we re not supposed to pay attention and people who focus too much like me get confused for being skeptical and checking all
+ 2
anyway they didn t test us on it some guy told me it s a change in the array reassigning values to element of that index
+ 2
int myarr[ ] [ ]={1,2,3},{4},,{5,6,7};
myarr[0][1]=42
+ 2
that's the only thing that makes sense i guess
+ 2
i can get the option to verify my account with email .Do you know how i could fix this and is it possible to get some friends here to help each other learn and make it fun