Тёмный

Java 2D arrays 🚚 

Bro Code
Подписаться 1,9 млн
Просмотров 161 тыс.
50% 1

Java 2D multidimensional arrays tutorial explained
#Java #2D #arrays #multidimensional

Наука

Опубликовано:

 

2 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 170   
@BroCodez
@BroCodez 3 года назад
public class Main { public static void main(String[] args) { // 2D array = an array of arrays String[][] cars = { {"Camaro","Corvette","Silverado"}, {"Mustang","Ranger","F-150"}, {"Ferrari","Lambo","Tesla"} }; /* cars[0][0] = "Camaro"; cars[0][1] = "Corvette"; cars[0][2] = "Silverado"; cars[1][0] = "Mustang"; cars[1][1] = "Ranger"; cars[1][2] = "F-150"; cars[2][0] = "Ferrari"; cars[2][1] = "Lambo"; cars[2][2] = "Tesla"; */ for(int i=0; i
@krisykrongdiaries4786
@krisykrongdiaries4786 8 месяцев назад
Wow
@RestedAura2
@RestedAura2 Год назад
To clarify those who don't understand what does cars.length and cars[i].length means, basically: cars.length: detect how many instances/objects are there in the row of the 2D array and cars[i].length: detects how many instances/objects are there in the column of the 2D array
@misfire32
@misfire32 9 месяцев назад
Thanks bro, the loop now makes sense to me, I didn't understand how the j int was smaller than the i int while they were both zero.
@hussinmomen5256
@hussinmomen5256 6 месяцев назад
thx bro
@maximizer174
@maximizer174 2 месяца назад
@RestedAura2 you mean the opposite right? cars.length : no of objects in column (vertically/ up to down) or Basically determine no of rows cars[i].length : no of objects in row (horizontally/ left to right) or Basically determine no of columns i was super confused on this topic. correct me if I'm wrong
@transfertransfer986
@transfertransfer986 Месяц назад
​@@maximizer174bruh, you got it mixed up. Columns are verticles (top to bottom) Rows are horizontal (left to right)
@maximizer174
@maximizer174 Месяц назад
@@transfertransfer986 isn't that what i said? 😅
@erneztoyo
@erneztoyo 3 года назад
System.out.println("Great Video");
@mkbedi
@mkbedi 11 месяцев назад
Boolean comment = true;
@godcomplex1929
@godcomplex1929 6 месяцев назад
If(comment = true) {System.out.println("Amen to that");}
@christiangalagar9213
@christiangalagar9213 2 месяца назад
​@@godcomplex1929error
@lobitu3423
@lobitu3423 12 дней назад
​@@godcomplex1929 your comment is messed up
@dolemerchant69
@dolemerchant69 7 месяцев назад
have been watching ur vids the last few weeks since starting CS in college. they’ve helped so much, thank you
@JuliHoffman
@JuliHoffman 2 года назад
I can't believe I understood this! You have excellent teaching skills.
@pavelkvasnicka6856
@pavelkvasnicka6856 Год назад
This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro
@fieldsfury
@fieldsfury 2 года назад
Amazing video! Watching all of these to refresh and learn!
@youngdumbguitarist5348
@youngdumbguitarist5348 Год назад
This is such a helpful and well explained video! Thanks!
@cesara9747
@cesara9747 2 года назад
Your tutorials are the best!
@danchavyn
@danchavyn 2 года назад
Your video helped me a lot! It was the only tutorial that solved my problem. Thank you!
@dillonpaul1498
@dillonpaul1498 Год назад
best teacher ever.. good job bro
@davidbolduc4378
@davidbolduc4378 2 года назад
I love watching these videos before class.
@honoredegg
@honoredegg 2 года назад
2d arrays understood completely. 16th. Thank you, ma Bro Sensei!
@vedmahant7776
@vedmahant7776 Год назад
Thanks for the help man, this video helped me a lot.
@DesiHabibi
@DesiHabibi 2 года назад
AMAZING ! BEST TUTORIALS HANDS DOWN !
@noah77
@noah77 3 года назад
Ooo nice, I wanted one of these.
@rr3nn638
@rr3nn638 3 года назад
Nice quick and easy explanation. Great job!
@medjl6083
@medjl6083 3 года назад
This is important video for multi-dimentional array.
@ascar66
@ascar66 11 месяцев назад
Good video, thanks for sharing
@haykmanukyan5462
@haykmanukyan5462 2 года назад
simple & great! thanks
@Clarara-is9li
@Clarara-is9li 3 месяца назад
Okay now its etched in my brain Thanks dude :)
@emachine003
@emachine003 Год назад
i have a java final Friday, so thanks for this video!
@supernovic99
@supernovic99 Год назад
This video was so useful!!! Thank you Bro!
@nirvomind
@nirvomind 3 года назад
Thanks , best explanation !
@eugenemolchan5141
@eugenemolchan5141 3 года назад
You are the best bro!
@jeyhunaliyev1765
@jeyhunaliyev1765 3 года назад
Awesome 👏
@uc8xo
@uc8xo 9 месяцев назад
Bro it helped me tommorrow is my exam and was clulessly watching this now
@loopify3905
@loopify3905 3 года назад
very nice explained
@mycake1515
@mycake1515 9 месяцев назад
When I was watching your 2d array tutorial it reminded me of Inception and the concept of dreams within a dream. Sounds stupid but it actually works lmao.
@-omarabusnineh5174
@-omarabusnineh5174 3 года назад
Thank u Ms.Bro, I'm from Jordan.
@coreywoodring3905
@coreywoodring3905 3 месяца назад
Great Job!
@trickysachin
@trickysachin 2 года назад
Awesome👏👏😊😊
@sihleeundefined1208
@sihleeundefined1208 3 года назад
Thanks bro, keep it up💪🏿💪🏿💪🏿
@yevgenomelchenko732
@yevgenomelchenko732 Год назад
Thanks for the lesson
@IceBeam93
@IceBeam93 3 года назад
I did this with pokemon: public class Array2Ds { public static void main(String[] args) { String[][] pokemon = {{"Bulbasaur", "Ivysaur", "Venusaur"}, {"Charmander", "Charmeleon", "Charizard"}, {"Squirtle", "Wartortle", "Blastoise"} }; //This also works but define it at the top already: String[][] pokemon = new String[3][3]; // pokemon[0][0] = "Bulbasaur"; // pokemon[0][1] = "Ivysaur"; // pokemon[0][2] = "Venusaur"; // pokemon[1][0] = "Charmander"; // pokemon[1][1] = "Charmeleon"; // pokemon[1][2] = "Charizard"; // pokemon[2][0] = "Squirtle"; // pokemon[2][1] = "Wartortle"; // pokemon[2][2] = "Blastoise"; for (int i = 0; i < pokemon.length; i++) { System.out.println(); for (int j = 0; j < pokemon.length; j++) { System.out.print(pokemon[i][j]+ " "); } } } }
@BroCodez
@BroCodez 3 года назад
nice! That's a good visualization
@d_36_priyanshuurwate65
@d_36_priyanshuurwate65 2 года назад
i love pokemon too my code is little diffrent but thNK U BRO
@user-ud6bi6nv6d
@user-ud6bi6nv6d 9 месяцев назад
love aesthetic code@@BroCodez
@ibrahimylmaz8378
@ibrahimylmaz8378 2 года назад
you are the man!
@BrokenG-String
@BrokenG-String 5 месяцев назад
Great vid, although it would have been nice for you to also include how you can access the data within a 2D array and why you would wanna use a 2D array in the first place.
@justinbanza4751
@justinbanza4751 2 года назад
Thank you very much for this video
@shyam.upadhyay
@shyam.upadhyay 2 года назад
I have smashed that like button so hard, there is a hole is my screen now. Worth it!
@zari_723
@zari_723 2 года назад
thanks, it's so helpful
@jackepra8026
@jackepra8026 Год назад
Thanks you!! Very usefull
@dew6739
@dew6739 2 года назад
Good job
@relaxjam1952
@relaxjam1952 Месяц назад
you are the best
@soumelee5661
@soumelee5661 Год назад
cool cars bro
@kirillutsenko9306
@kirillutsenko9306 2 года назад
thx a lot for your help
@bekturasanbekov1979
@bekturasanbekov1979 Год назад
thx 4 vid bro !
@mithunbabbira
@mithunbabbira 3 года назад
amazing
@freedom4218
@freedom4218 13 дней назад
Yeah!
@ghoggaliabdou4222
@ghoggaliabdou4222 3 года назад
Thank you so much 💙💙💙
@huuloc8719
@huuloc8719 2 года назад
Nice.
@jasonfenstermaker4
@jasonfenstermaker4 5 месяцев назад
You are getting me through QA class man
@Horatius_23
@Horatius_23 Год назад
THX!
@ardcodelover
@ardcodelover Год назад
Valuable bro
@omersond4891
@omersond4891 3 года назад
thanks for this
@witecki_
@witecki_ Год назад
bro where chalk up u been, it is so cool
@Santiago-iu8mk
@Santiago-iu8mk 2 года назад
Gracias brooo
@danny.3036
@danny.3036 3 года назад
Thanks, Bro! ☕
@phiphongnguyen3352
@phiphongnguyen3352 2 года назад
thanks you very much
@user-zq6yx7of5f
@user-zq6yx7of5f Год назад
thank you very much
@baharehkjani6761
@baharehkjani6761 9 месяцев назад
I kiss your head, dear bro code ! LOVED it ! Thank you !
@hadihiwa5690
@hadihiwa5690 2 месяца назад
Thanx bro
@zinebjinari7893
@zinebjinari7893 2 года назад
great
@adityaalshi7081
@adityaalshi7081 2 года назад
❤️👌
@tamirrozenfeld3572
@tamirrozenfeld3572 Год назад
Thank!!
@mohamedwafik3493
@mohamedwafik3493 2 года назад
👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏👏
@sairos4057
@sairos4057 Год назад
thanks bro
@kidcracker
@kidcracker 9 месяцев назад
ty bro
@bartomiejsniadach5795
@bartomiejsniadach5795 2 года назад
Thank you Bro
@percivalgebashe4376
@percivalgebashe4376 Год назад
Nice
@chiefeveryday7541
@chiefeveryday7541 Месяц назад
🐐
@quanyufeng579
@quanyufeng579 2 года назад
Thanks
@shivamgaming3559
@shivamgaming3559 2 месяца назад
👍
@bradleydeans192
@bradleydeans192 2 года назад
Why have cars[i].length in the nested for loop? It doesn't seem to be necessary since it will always be the length of the array anyways. Side note: Love these tutorials, they have all been excellent!
@udayrajoriyaa
@udayrajoriyaa Год назад
Yes it is not necessary if each row has same number of columns as number of rows, i.e. square array. Let's say if there are 3 rows total, and each row has 3 columns/elements in them, then cars.length = 3, which will work for this case. But, let's say if the array has 3 rows and 2 columns/elements in each row, this logic will break, since again cars.length will be equal to 3, and we know, the third column doesn't exist in any row. So, it's necessary to use cars[i].length as each row is a seperate array in itself. Also, each row can have varying number of columns/elements, which makes it extremely necessary to use the logic. For example consider this array: Tesla, BMW, Audi, Hyundai Mercedes, Volkswagen Range Rover, Buggati, Toyota First row has 4 elements, second row has 2 elements, while the third row has 3 elements.
@bibi.98x
@bibi.98x 9 месяцев назад
@@udayrajoriyaa thanks for the great explanation!
@PoorwayTraning
@PoorwayTraning Год назад
thanks
@ma8969
@ma8969 2 года назад
thank you
@uclong1176
@uclong1176 3 года назад
useful
@kiki.t2094
@kiki.t2094 2 года назад
Thank you Bro, you gave me an idea how I can solve my code problems 👍🙏
@ByeBaybe
@ByeBaybe 2 года назад
Bro, I literally type this out and I get a 1D aka a list. I've been thinking about this for at least 15 minutes without an answer. EDIT: Never mind. I'm a fucking moron. In the last line I wrote sysout + ctrl + space and that's 'System.out.println();' but I need 'System.out.print();'. The 'println' makes a whole new line for each bundle of text forcing the text into a list format. Holy shit I'm happy I'm a stubborn person and figured this out.
@cristiangarciaperez7230
@cristiangarciaperez7230 Год назад
what is cars.length representive of? like does that mean that I increases until all letters of cars are met or until all the cars are met? thanks
@albertocasanovalaras3153
@albertocasanovalaras3153 Год назад
cars.length is showing the number of instances that there is on that row. In this case that would be 3. That's why the loop keeps going as long as 'i' is lower than cars.length. cars.length = 3 'i' keeps increasing by 1 until it's no longer less than 3. So it goes like: 0, 1, 2. And then it stops, because 3 !< 3, it's equal. The same way, when you type it as cars[i].length, you are getting the number of instances on that column. On this example, that number is still 3, but if you added another row, it would be 4. Using this kind of loop, you make sure you're passing through every instance on your array. It's checking the length of every row on the first loop, and the length of every column on the nested loop. I hope this made sense, if you have any question, ask again and I'll try to clarify it.
@JusticeBeaver619
@JusticeBeaver619 Год назад
@@albertocasanovalaras3153 got it. But can you please explain why we use cars[i].length instead of just cars.length . The value is 3 in both cases
@jironamos7650
@jironamos7650 Год назад
@@JusticeBeaver619 Imagine as if he made a variable of Columns and Rows, and assigned the values to each, you could have called that variable in the place of using cars.lenght or cars[i].lenght, which essentially means, "if i is less than Columns" or "if j is less than rows"
@lukedecum
@lukedecum 10 месяцев назад
bro!!
@D14R
@D14R Год назад
So Public static void main is method (String [] args) is array???
@greeneggsandmushrooms9855
@greeneggsandmushrooms9855 3 года назад
i miss 3d dorritos
@grozageorge2887
@grozageorge2887 Год назад
😀
@eugenezuev7349
@eugenezuev7349 2 месяца назад
Bro helps
@danielmilewski7659
@danielmilewski7659 Год назад
comments for stats!
@mensahtribeadventures2630
@mensahtribeadventures2630 2 года назад
how would you bubble sort this 2d array
@blueking5739
@blueking5739 2 года назад
I don’t know what’s wrong with my console, it would display everything straight down and not on the side like his. I need help
@Simis999
@Simis999 Год назад
Back to the good microphone
@yeliza2350
@yeliza2350 2 года назад
6 ferbruar l watched
@kidhacker1000
@kidhacker1000 2 года назад
I have a question and would really appreciate anyone's help. I'm not understanding what the "length" is supposed to do in i
@bryanZ17
@bryanZ17 Год назад
As i undestand, that's used to read the size of the array. So the as long as counter doesn't surpass the size of the array, it will continue to loop around. Once, the counter matches the size or 'length' of the array, it will stop.
@wallstreetbets7741
@wallstreetbets7741 Год назад
learnt
@hermitmobile1742
@hermitmobile1742 2 года назад
this is for the youtube algorithm
@buddhimakaushalya2912
@buddhimakaushalya2912 2 года назад
GG GG GG
@aya2222
@aya2222 3 года назад
Why it should be "j
@shinkanade1552
@shinkanade1552 3 года назад
I had the same question lol, but i think it's because it's a 2D array.i'm not sur but i think it's to say the length of the row not the column. I will let Bro answer this :p
@behrangfattahi9328
@behrangfattahi9328 2 года назад
I would like to be a fellow bro, lol
@mohamedelfadli3125
@mohamedelfadli3125 Год назад
@user-km8ee6bm9y
@user-km8ee6bm9y Год назад
how to check if the matrix is quare : matrix[n][n]
@sihleeundefined1208
@sihleeundefined1208 3 года назад
So we can't remove an item within this array?
@tissue.5706
@tissue.5706 2 года назад
Idk whats happening to my Ide but it isnt becoming 2d but instead its a list idk why but i copy pasted ur code and it become 2d then I typed it again and its still a list :T
@ByeBaybe
@ByeBaybe 2 года назад
Last line needs to be System.out.print(cars[i][j]+" "); NOT System.out.println(cars[i][j]+" "); . Look for the 'ln' before 'print'. That's causing spaces inbetween each bundle of text.
@alialhussain4139
@alialhussain4139 Месяц назад
Thanks, Bro 06/02/2024
Далее
Java String methods 💬
6:18
Просмотров 108 тыс.
C 2D arrays ⬜
7:33
Просмотров 69 тыс.
Java arrays 🚗
6:26
Просмотров 178 тыс.
2D Arrays in Java
14:57
Просмотров 23 тыс.
Java constructors 👷
10:37
Просмотров 167 тыс.
8 Must Know JavaScript Array Methods
10:05
Просмотров 1 млн
Nested Loops & 2D Arrays | Java | Tutorial 23
13:15
Просмотров 110 тыс.
Introduction to Two-Dimensional (2D) Arrays
10:20
Просмотров 677 тыс.
Java ArrayList 🧾
4:33
Просмотров 138 тыс.
Улучшил свои Apple Watch!
0:25
Просмотров 27 тыс.
Развод с OZON - ноутбук за 2875₽
17:48