LUGG that are an orgy Come on now I want to actually refer to the name of this are eastern values OK
brackets.
Now we want to actually for the index number free inside of these.
Ari this index is number 0.
This index is number one and this index is number two and we don't have any index that could be called
index number four here.
This is index number 0.
This is index number one.
And this is indexed number two.
But here in this line of code in line 40 we are actually feeling the index number free which doesn't
exist in this array.
So let's actually go on our project and see what happens.
So as you can see here our application actually crashed and it says unfortunately ABBOTT Well has stopped.
OK.
So what's going on here.
Because we actually deferred to our value OK to an index of this area that actually doesn't exist.
That's why our Actually our application crashed and we cannot refer to an index of an array which doesn't
exist.
Index Number Three doesn't exist in this array.
This is number index number 0.
This is index number one.
And this is index number two.
OK.
We don't have index number free in this area.
It is true that these are the size of this array is free.
But remember programming especially in arrays we count from number zero.
OK.
Number 0 1 2.
We don't have number three here so we cannot refer to that index number free here.
So this is wrong.
We can actually only refer to index number 0 or index number one or index number two.
So let's actually run our project and see what happens.
So as you can see here our application is actually running on the emulator.
And fortunately our application didn't crash this time.
So as you can see here inside that lock now we can see disvalue table here.
OK.
So here you specified that are string values index number 2.
So it can actually return this value table here.
OK.
It's going to start out with this value to that to the lock.
So hopefully that makes sense.
And let's actually comment out these lines of code here and here we can actually output some values
to the screen and we don't need these lines of code here anymore so I just commented out them.
Now let's actually start coding here.
OK.
OK everyone.
Now let's actually create some objects from the text your class takes you to the index or key assignment
operator.
And here we need to actually cast this object to I talk text view object find view by ID are thought
Id DOT takes the index.
OK.
Let's actually create another text view object X the value assignment operator takes a view find view
by id r that Id DOT takes the value.
OK so now let's actually create two string variables.
Strange.
And the name of our idea is all the index value.
OK.
Again let's actually create another string variable.
Old the value.
Value.
OK.
So as you can see here I didn't instantiate these string variables.
So by default these are variables are going to actually fail to a null object inside the memory.
OK because we didn't assign any value to these string variables.
And because our string is actually a class.
So if you are actually Fehring to an object inside the memory.
So here this object actually refers to a null object inside the memory key because we didn't assign
any value to this string object.
So here let's actually create an array of integer numbers in it.
And here let's actually putting a pair of brackets after our type of data type.
We need to actually put in a pair of brackets because we want to actually create an array.
And here let's actually give a name to what are they.
For example int array.
OK.
Assignment operator and here I want to actually create an array by using the new operator here int and
here inside the brackets.
I need to actually specify the size of my array.
Ok so my ARA is going to actually accept 10 values of type integer.
OK so now let's actually create a for loop and here inside the prentices.
Let's actually create an integer variable into counter.
OK.
Assignment operator zero counter less than int array.
That's Len.
OK.
Trantor plus plus.
OK so now as you can see first we created an integer variable called counter and we assigned numbers
zero to this counter.
And here we are actually creating a condition.
And here we are saying that until the counter is less than the value of the length of this array.
OK.
So the length of this area is 10 until this value.
These are the value of this counter is less than number 10.
OK.
0 1 2 3 4 5 6 7 8 9.
So until it reaches number 9 it is going to actually execute this loop and after it reaches number two
and the value of this counter is 10 it's going to actually skip this loop here and then it's going to
actually execute are lines of code after this loop here.
OK.
So here we are saying that increment the value of this counter variable Bhagavan every time this loop
is executed OK.
So now inside the loop I can actually put in some more lines of code.
So first of all it's actually a instantiate.
This all takes the index value assignment operator ticks the index dot get text that string.
OK.
Here we are actually getting the value of the CTX the index takes you.
So this is.
So here let's actually click on this clear cache here.
So this is the value of these RTX the index.
OK.
This is TSTO the stakes for you as you can see here.
And this is the X the value takes.
OK.
And here is our line of code as you can see inside the loop.
I am getting the value of those takes.
OK.
And I am putting that value inside this all the x the index value.
And let's actually instantiate this or Tillich's the value of value assignment operator TXI the value
that get text dot to a string.
OK.
And here I am actually getting the value of that RTX the value here and I am actually converting that
value to a string value.
And here I am actually assigning value to these all the value value OK.
So now here it's actually putting some values to these in the index text view.
And these takes the value takes view.
So here I can just I've been to the index dot set text here.
And then inside the parenthesis I can just type in all it takes the index value OK plus counter.
OK.
Plus two double quotes and inserted double quotes.
I can just put in a new line character OK.
So back for Slash and I am actually putting the all the value of the index takes view plus counter.
OK.
And I am actually putting the counter here.
The value of this counter like Index and here I am actually creating a newline character OK.
So after each execution of this loop is going to actually create a newline character and then it's going
to put values below each other.
So let's actually 5:47 the value that said text.
All takes the value value plus.
OK.
And this time I want to actually output the value that is inside of this area here and that is.
And that value is related to that specific index that specific counter.
So here I again just refer to the name of this int array here.
I need to actually put in a pair of brackets and I want the value that is inside of that counter.
OK.
And here I need to actually put in a plus operator and two double quotes here and a new line character.
So here as you can see I am referring to the name of this order takes the value of value valuable as
you can see here.
This idea has that value.
This has the value that is inside the text the value takes you plus and I put a plus operator here in
order to concatenate this value with other values.
So here we are actually referring to the name of this area 8 into the sub counter.
OK.
So it's going to actually give me the value that is inside of that specific counter.
Ok for example.
So the first time this loop is going to be executed or the value of this counter is zero.
OK.
And it's going to actually check this condition.
So sort Chouteau is less than an hour late that lent.
So it is true zero is a little less than 10.
And then it's going to go inside the loop.
And then after executing these two lines of code here after assigning these values to these valuable
it's going actually execute these lines of coheres can actually output this value discounted value to
their screen or to the index value plus counter.
OK so the counter is this right your number zero and then I actually create a newline character and
then it's going to output this value to the screen or all takes the value value OK plus it Eric Cantor
counter is 0.
So the value of that is inside of the counter zero is for example and not Baraki is going to outputs
that value to the screen.
So let's actually it on our project and see the results.
So as you can see here now our application is actually running on this emulator here.
Okay.
And here on the left hand side we can see the indexes and on the right hand side we can see the values
that are actually related to these indexes.
Okay.
So because we didn't assign any value to the indexes of this array that the values that are actually
related to these indexes are zero.
The default value is zero.
OK for the indexes of the rate that we actually create here we just specify that this array is going
to have 10 places 10 empty places for the values that we can specify to those places.
Okay.
And for example a place that is actually the index 0 means the place number 0 has the value zero.
So this is the default value the place number one has the value 0 and so on.
So now it's actually here after creating or out a let's actually assign a value to one of those indexes
for example int array and then here we can actually put in a pair of brackets.
And for example I can I want to I want to actually assign a value to the index number five.
OK.
And now I can actually assign an integer value to this index.
For example number 27 and this actually is on our project and see what happens.
OK everyone.
Now as you can see here we can see the value that is actually related to this index.
OK.
So hopefully that makes sense.
And I think that's enough for this tutorial.
Make sure that you actually create this application over and over.
So that are creating alleys in Java because a second nature arrays are very important so you need to
know how to work with arrays in order to create great and great applications.
OK.
So this is really important.
And this section of the course I think is the most important section of the course.
Thank you very much for watching.
And if you have any questions please post the discussion in the course and then I'll do my best to answer
your questions and I'll see you in the next tutorial.