6.11 Enhanced for Loop with 2D Array

preview_player
Показать описание
The enhanced for loop was introduced in Java 5 as a simpler way to iterate through all the elements of a Collection (Collections are not covered in these pages). Enhanced for loops are simple but inflexible. They can be used when you wish to step through the elements of the array in first-to-last order, and you do not need to know the index of the current element. In all other cases, the "standard" for loop should be preferred.

Follow on Facebook:

Subscribe to our other channel:
Telusko Hindi :
Рекомендации по теме
Комментарии
Автор

Thank you so much! This helped me understand how to traverse a 2d array with enhanced for loops, now I will be more prepared for the AP test that I have to take tomorrow! 😅 thank you

anima
Автор

OMG I was reading a book on using the enhanced for on multi-arrays and you explained BETTER!! You broke it down very well. Thank you very much. Please keep making videos!

MichaelMooregrownman
Автор

Perfect this channel has all answers for my "How" And "why".👍😃

prajwalgaikwad
Автор

You are a good finisher of problem solving !!

ShivamKumar-sczx
Автор

wow yu r so intellingent...yu knw hw to get into somebody's mind...all yur vedios r good :)

meghashetty
Автор

very useful! I recommend this video for this particular case! will give you a better understanding!

shayondebroy
Автор

Sir yours teaching is very good. Try to upload more videos on java every topic

ramyach
Автор

Please make a video to calculate absolute difference of diagonal matrix using advanced for loop

archanahosamani
Автор

A lot helped! Thanks more than a thanks!!

ahora
Автор

Sir when in enhanced for loop i is element we declare right as "int i ", but when declaring i as arrary why we declare it normally as "int i[ ]" it should be declared as "int i[ ] = new int[]" first and then transfer array in for

hamzabohra
Автор

Can we use enhanced for loop in c c++ programs??

vanshikamittal
Автор

sir why do u change to mac and Windows alternately?

shaileshsingh
Автор

How did you applied single line comment all together by selecting the reqiuired code?

kunwartaneja
Автор

Sir how are commenting the code so quickly?

sairajdas
Автор

Sir is it possible to use for each loop for taking input elements

vinayvenkatesh
Автор

Sir can I use Random number for 2D array..?

vidheesavani
Автор

Heard about Vowels? Have a look. Will make your speech better and ease your listeners! Great explanation though.

micky
Автор

can anybody please tell me why i am getting hashed values for the below code.

package pr1;

public class Arr2d {

public static void main(String[] args) {

int x[]= {5, 6, 7, 8};
int y[]= {3, 4, 1, 2};
int z[]= {0, 9, 8, 7};

int a[][]= {{5, 6, 7, 8}, {3, 4, 1, 2}, {0, 9, 8, 7}};

for(int n[] : a)
{

for(int m : n)

{ System.out.println(n);}


}
System.out.println(a[2][3]);
}

}

samantkumar
Автор

package javaapplication127;
import java.util.Random;
public class random_class {
public static void main(String[] args) {
Random r= new Random();
int array[][] = new int[5][8];
for (int i=0;i<5;i++)
{
for (int j=0;j<8;j++)
{
array[i][j]=r.nextInt(100);
}
}
for(int x[]:array)
{
for(int y: x)
{
System.out.print(y+" ");
}
System.out.println();
}
}
}

shuvshaw