Arrays in java

Published: 11 April 2017
on channel: kudvenkat
15,797
74

Java tutorial for beginners playlist
   • Java tutorial for beginners  

What is an array
1. Container that holds fixed number of values
2. All values are of single type
3. Length of Array is fixed during creation

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
   / @aarvikitchen5572  

Array Example
String[] args in main function

Declaring one dimensional array in java

int[] anArray; // declares an array of integers
char[] charArray; // declares character array

Another form of declaration

int anArray[];
char charArray[];

Initializing one dimensional array in java

int[] anArray = new int[10];
OR
int[] anArray;
anArray = new int[10]

Shortcut to initialization
int[] anArray = { 100, 200, 300, 400, 500 }

Multidimensional Array in Java
In a multidimensional array, each element is an array

int[][] matrix = new int[5][5];

int[][] matrix = {
{ 1, 0, 1},
{ 1, 1, 1},
{ 1, 1, 0}
};


On this page of the site you can watch the video online Arrays in java with a duration of online in good quality, which was uploaded by the user kudvenkat 11 April 2017, share the link with friends and acquaintances, this video has already been watched 15,797 times on youtube and it was liked by 74 viewers. Enjoy your viewing!