#5.1 Java Tutorial | Array 1D | 2D | Jagged Array

preview_player
Показать описание
We need an array when we have multiple elements and we want to ensure storing those elements into two different variables for that we can use one common variable where we can store all the values.
- To create an array of integers, we will follow the syntax:
int nums[] = new int[4];
- In Java, array is an object so ww have to use a new keyword.
- int is used to define the data type of an array that is Integer.
- We need to define the size of an array and by writing 4 , we have fixed the size.
- It will provied that memory in the heap area.
- In arrays, indexing always starts from 0.
- We can also specify the values in an array individually as:
nums[0]=8;
- We can fetch the value from an array through indices.
- We can also change the value in an array after defining it once.
- It will give you the "ArrayIndexOutOfBoundException", when you will try to fetch or assign values out of the boundary of size of an array.
- We can also print all values of an array in one go through the loop.
- If you know the values predefined, then we directly specify the values by following the syntax:
int nums={8,12,76,54};
- We can also create an array of objects.

2-D (Two dimensional) Arrays:-
- We create an array that itself contains an array.
- In Java, 2D arrays are stored in arrays as arrays.
- A 2D array consists of rows and columns.
- 2D array can be created using the syntax:
int d[][]={ {1,2,3,4},{2,4,6,8},{5,6,7,8}};
- We can use nested loops to print all values of a 2D array where an outer loop is used to iterate through rows and an inner is used to iterating through columns.

Jagged Array:
- When the number of columns is not fixed in an array, we call it a Jagged array.
- length function is used to find the length of an array.

In this video we will see :
- Practical example of an array
- Define array
- Defining size of the array
- Fetching value from array
- One dimensional array
- Two dimensional array
- Fetching values from 2D Array
- Jagged Array

An array is a container object that holds a fixed number of values of a single type.
The length of an array is established when the array is created.
After creation, its length is fixed.
Each item in an array is called an element, and each element is accessed by its numerical index numbering begins with 0.

More Learning :

Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
Рекомендации по теме
Комментарии
Автор

Perfect ! Animation helps a lot (faster knowledge transfer) ! Practical example - great. Keep on ...

vladanulardzic
Автор

Ultimate boss don't stope makeing videos and try to elobrate everything in more deep with practically 🙏🙏🙏

aniksoni
Автор

Your animation while teaching is awesome it clears the problem more

PritishMishra
Автор

I understood the concept already but the explanation here was much more clear. Thanks.

_GrumpyBear_
Автор

Great work! Very useful videos for beginners like me.

alexandroskaripidis
Автор

easy understandable with practical, good one sir, thank you 👍👍

SmartProgramming
Автор

Great explanation ever sir!
Simultaneously animated picture was helpful!!

Abhishek-lxpv
Автор

This was amazing and very very very very helpful thanks keep posting

anamikayadav
Автор

Jagged array from 11:05, good explanation

shubhampatel
Автор

Superb Explanation as usual. Thanks much.

Ravikumar-buge
Автор

it's makiing total sence thank you, keep working bro...

yashrajsinhjadeja
Автор

thanks bro i found a solution after i seen your video

naveenraj
Автор

Thanks a lot to upload this and i like this video
And nice explanation

globbyglad
Автор

Sir please share the solution codes of the assignments given so that it may be helpful for us

nomanaasifgudur
Автор

thank you so much you are the best 1... even i suggest to my all friends follow #telusko Learning.

sagargondaliya
Автор

in programming two things I hate a lot 1) array 2) function calling procedure in mind

rabeaahsan
Автор

Easily learn by you... Thanks a lot...

tanvirmasum
Автор

You are awsm sir, alays love your video.. :)

ArjunAcharjee
Автор

Why they made the array as whole distinct class what is need of??

adityanpanchal
Автор

Hii sir can u tell me the answer for this: { public
static void main(String args[]) { int arr[] = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int n = 6; n = arr[arr[n] / 2]; System.out.println(arr[n] / 2); } }

calvinkoshy