Array vs. ArrayList in Java Tutorial - What's The Difference?

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ก.พ. 2021
  • Arrays vs. ArrayLists - What's the difference? How do you use each of them, and which one should you use and why?
    We'll go in-depth about the similarities and differences between Array and ArrayList in Java, and talk about how to create them, add elements, remove elements, and more.
    This is a beginner friendly beginner's Java coding lesson tutorial, where we'll talk all about using Arrays and ArrayLists.
    Learn or improve your Java by watching it being coded live!
    Hey, I'm John! I'm a Lead Java Software Engineer who has been in the industry for over a decade. I love sharing what I've learned over the years in a way that's understandable.
    Let me know what else you'd like to see!
    Links to any stuff in this description are affiliate links, so if you buy a product through those links I may earn a small commission.
    📕 THE best book to learn Java, Effective Java by Joshua Bloch
    amzn.to/36AfdUu
    📕 One of my favorite programming books, Clean Code by Robert Martin
    amzn.to/3GTPVhf
    🎧 Or get the audio version of Clean Code for FREE here with an Audible free trial
    www.audibletrial.com/johnclean...
    🖥️Standing desk brand I use for recording (get a code for $30 off through this link!)
    bit.ly/3QPNGko
    📹Phone I use for recording:
    amzn.to/3HepYJu
    🎙️Microphone I use (classy, I know):
    amzn.to/3AYGdbz
    Donate with PayPal (Thank you so much!)
    www.paypal.com/donate/?hosted...
    ☕Complete Java course:
    codingwithjohn.thinkific.com/...
    codingwithjohn.com
    Full source code available here: codingwithjohn.com/array-vs-a...
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 519

  • @whatisahandleeee
    @whatisahandleeee 2 ปีที่แล้ว +360

    Easily top 3 programming teachers on youtube. No joke. You seem to answer the exact questions that a newbie would asks and you answer in such a way that gives exactly the information that is needed.

    • @ilhammammadli4560
      @ilhammammadli4560 ปีที่แล้ว +1

      who is rest?

    • @whatisahandleeee
      @whatisahandleeee ปีที่แล้ว +5

      @@ilhammammadli4560 Corey Schafer is one of them for sure.

    • @sophie6425
      @sophie6425 ปีที่แล้ว +4

      Agreed! I´m a first semester Computer Science student and we must do these little coding exercises. The lectures don´t really help, but these videos really got me through these tasks.

  • @glefordbanglayan5322
    @glefordbanglayan5322 3 ปีที่แล้ว +324

    PLEASE DONT STOP TEACHING THIS THINGS.. I HAVE WATCHED A LOT OF GUYS LIKE U ON TH-cam AND UR ONE OF THE BEST. AND STILL I LOVE JAVA MORE EVEN AFTER MEETING PYTHON

    • @trynafindkaygee_
      @trynafindkaygee_ 2 ปีที่แล้ว +3

      i can relate to that❤😎👌

    • @spacepowerofficial1187
      @spacepowerofficial1187 ปีที่แล้ว +4

      I didn't see the DONT and I got really confused

    • @butterandjamtoast
      @butterandjamtoast ปีที่แล้ว +3

      Caps Lock. The cruise control to cool 😎

    • @user-pp1cn2ut4y
      @user-pp1cn2ut4y ปีที่แล้ว

      Axper angleren chem xosum ches kara bacatres incha patmum?

    • @darrenfrancis8126
      @darrenfrancis8126 ปีที่แล้ว +2

      @@spacepowerofficial1187 PLEASE STOP TEACHING
      imagine

  • @kerwinso
    @kerwinso 2 ปีที่แล้ว +113

    You explain diamond operators (starting at 4:19) in 20 seconds better than others who have taken over 5 minutes. Well done sir.

  • @sanabil2531
    @sanabil2531 3 ปีที่แล้ว +263

    you are going to have million subscribers one day, already telling ya, you teach so well :)

    • @wankhede09
      @wankhede09 2 ปีที่แล้ว +2

      I Second that

    • @CheeseStickzZ
      @CheeseStickzZ 2 ปีที่แล้ว +9

      That's a nice notion but no he wont. Programming is not that popular. Only stupid things are popular, entertainment and food and monkeying around

    • @alicewu6674
      @alicewu6674 2 ปีที่แล้ว +3

      I agree... he is great teacher, I love his coding tutorials cuz they are the ones that are among the most understandable and well-explained:)

    • @renathanobre
      @renathanobre 2 ปีที่แล้ว

      indeed

    • @MakeItStik
      @MakeItStik 2 ปีที่แล้ว

      He is close

  • @anityyu
    @anityyu ปีที่แล้ว +3

    I love how my school explains these things in 10 videos and it takes over 5 hours to watch all of them, while I can easily learn it from your video in just 18 min

  • @shirinelmanson7839
    @shirinelmanson7839 3 ปีที่แล้ว +10

    I am literally I am shocked how come you do not have 1 million subscribes ..the way you teach is awsome.

  • @HuwJones
    @HuwJones ปีที่แล้ว +33

    Great video. Two things....it's considered good practice to use the interface on the left side so List instead of ArrayList before the variable name. And while you are right that the ArrayList itself can grow and shrink it's really important to be aware that the array that backs the ArrayList (yes there's an array hiding inside the ArrayList implementation!) does not shrink automatically after the ArrayList has grown...this can be very significant when profiling the memory footprint of an application. Lastly, it would be really good to have a video on why you'd pick a primitive representation over its Object form.....performance, memory usage, etc.

  • @mk17173n
    @mk17173n ปีที่แล้ว +3

    This dude is the man. His videos are better than others because he answers the question why. Why do we do it this way? Keep it up dude.

  • @oldschoolmath8480
    @oldschoolmath8480 3 ปีที่แล้ว +21

    Thanks so much for sharing this video! We watched this in my AP CS A course after finishing a unit on Arrays and you did a great job of giving us an intro to ArrayLists.

  • @bbalmer7878
    @bbalmer7878 8 หลายเดือนก่อน +1

    as I was watching I thought "BUT-BUT you cant DO THAT!" and then you wrote "//you can't do that "
    and i got just a nice ass dopamine hit, thank you.

  • @filipemelo1107
    @filipemelo1107 2 ปีที่แล้ว +5

    I freaking love the way you approach the subject on your videos... It's so simple and yet, complete; I can understand everything so easily.

  • @aces8481
    @aces8481 2 ปีที่แล้ว +4

    you are 100% my go to person on TH-cam for beginner tutorials -> explanations are always really beginner friendly and so clear and easily digestible. Thanks a ton man

  • @thecolorblue7427
    @thecolorblue7427 2 ปีที่แล้ว +21

    I was not expecting such a easy to understand, and great tutorial like this! thank you so much

  • @carlosgranda8493
    @carlosgranda8493 2 ปีที่แล้ว +1

    Dude, I swear to God how can you explain so well that I didn't get distracted. bro when my teachers explain I lose focus so fast, dude keep it going you are amazing.

  • @tbone587
    @tbone587 2 ปีที่แล้ว +1

    I been using java for over a decade and I have still been enjoying your videos! You explain things very well and even these basic concepts are engaging to watch lol

  • @StephenMoreira
    @StephenMoreira ปีที่แล้ว

    I've been out of the Java Ecosystem for years, but I randomly got to your channel I have been enjoying just listening on some of the details of Java again. Great content.

  • @robertjr8205
    @robertjr8205 2 หลายเดือนก่อน +1

    Watching your videos helps me understand so much better. You explain everything perfectly and add in the little important details that most books or instructors seem to not mention,
    Thank you!

  • @miigon9117
    @miigon9117 3 ปีที่แล้ว +7

    Cool video. So informative yet so clear and easy to understand. I’m learning java programming as a hobby language and your explanation is the best I have seen on TH-cam!!!

  • @osanbrazil999
    @osanbrazil999 ปีที่แล้ว

    You're the best because you speak fast and get direct to the point with the exact needed amount of information, period.

  • @sajidamoin771
    @sajidamoin771 22 วันที่ผ่านมา

    You are one of the smartest teachers on youtube… I love your teaching style…Whenever I want to learn a java topic, I first search it on your channel because you explain every topic in a very simple way. Not too much of information not too less… just as much as needed for a beginner… My favorite ❤️

  • @SophoniasT
    @SophoniasT ปีที่แล้ว

    My first video and I just want to say that please keep going. This helped me in so many ways. Easy to understand explanation and very helpful interaction. God bless you. You have a subscriber! 🙏🏽👏🏾👏🏾👏🏾👏🏾👏🏾

  • @jaspersumugat6951
    @jaspersumugat6951 ปีที่แล้ว

    Such a lifesaver, I'm currently working for our activity involving arrays and this video showed up. Very informative, no subtle introduction just worth of my remaining time haha. Thank you so much!

  • @gabrielmicillo7763
    @gabrielmicillo7763 2 ปีที่แล้ว +1

    This channel and its content its excellent.. im learning Java and I found it so much easier with these videos than my actual lectures. Also the edition of these videos is great. Please dont ever stop making videos about Java. I honestly think is by far the best there is on youtube, and all divided on little videos so it doesnt feel overwhelming like starting a new course.

  • @barnabastyav3575
    @barnabastyav3575 ปีที่แล้ว

    this is the best java tutorial i have ever watch , i wish John had a complete series from the basics up, i can beat my chest and say i understand the differences between Arrays and Array list, I recommend it for anyone looking up the internet for answers to arrays and array list

  • @akshatmehra3951
    @akshatmehra3951 ปีที่แล้ว

    Awesome ! Learning java, coming from c++ and js background. This man has taught so much stuff so easily and quickly. Thanks a ton John !

  • @danielbressner6125
    @danielbressner6125 2 ปีที่แล้ว

    Yet another great walkthrough. This channel has been such a huge help in my own Java journey.

  • @preciouspearl8583
    @preciouspearl8583 ปีที่แล้ว

    Thumbs up i searched so many tutorials but find yours the straight to the point one

  • @tinongsot6267
    @tinongsot6267 2 ปีที่แล้ว +1

    This channel is really underrated, I learned a lot just from this video.
    You’re doing great. Thank you John

  • @michaelekpo4011
    @michaelekpo4011 ปีที่แล้ว

    Thanks Coding with John! One of the best videos I've seen throwing so much light on this subject.

  • @lootster
    @lootster 10 หลายเดือนก่อน +1

    TH-cam algo sucks for not recommending this wonderful video for Java learner! But better late than never!

  • @eddyvlogss
    @eddyvlogss ปีที่แล้ว

    Awesome way of teaching John.. please don't stop teaching at any cost. This really helps a lot of people !! you deserve more subscribers

  • @mastermatt6090
    @mastermatt6090 2 หลายเดือนก่อน +1

    Thanks dude, you make everything so simple!

  • @Timeless_Trader
    @Timeless_Trader ปีที่แล้ว +1

    Thanks John. This is a great learning. I would recommend this channel to my friends too because things explained are to the point, no random things. Thanks again. Subscribed

  • @wayneinteressierts9973
    @wayneinteressierts9973 11 หลายเดือนก่อน

    Man, John! Thank you so much! I‘m about to start my first developer job and see your videos daily! You are so great help!!! Please keep going!

  • @masikajenniffer6473
    @masikajenniffer6473 2 ปีที่แล้ว +3

    This is amazing.The explanation is really easy to follow and understand. I hope many more people can watch and subscribe. Thanks for the tutorial

  • @CoolBear619
    @CoolBear619 4 หลายเดือนก่อน

    Thanks much John! Because of you I have cracked 2 interviews. Loads of love from India. Keep teaching us!🎉

  • @anddavinci6691
    @anddavinci6691 6 หลายเดือนก่อน

    Thank you so much! I’ve been learning so much faster since I have started watching your videos.

  • @erickferraz5529
    @erickferraz5529 2 ปีที่แล้ว

    Dude, thanks a lot. I’m from Brazil and just had 3 hours of class in my own language and couldn’t get what I got in 17 min in your video. U r a legend.

  • @ralphgore3543
    @ralphgore3543 2 ปีที่แล้ว +1

    John, I discovered you yesterday and you are one of the best!

  • @Charnelex
    @Charnelex 2 ปีที่แล้ว +1

    John, I'm just getting started in Java and I appreciate you. Commenting to help the algorithm.

  • @MuniraHersi
    @MuniraHersi ปีที่แล้ว

    Thank you so much for all of your videos. You got a new follower, and you are really good at explaining java. Hope to see your channel grow!!!

  • @banglepq
    @banglepq 2 ปีที่แล้ว +1

    Thank you John so much for this video. It's really helpful for me to understand differences between array and arraylist.

  • @keremgobekcioglu4686
    @keremgobekcioglu4686 ปีที่แล้ว

    Liked this video , John. I have started to code in Java , after 1.5 year with C and C++. Now i'm learning some differences from you. Keep up.

  • @vishnuvinod8738
    @vishnuvinod8738 2 ปีที่แล้ว

    Your are awesome man ❤️
    You teach so nice. You are adding every information about the topic into a single video. And also videos are not too lengthy.
    Loved to watch every videos you posted.
    Don't stop please.

  • @footballplayer3195
    @footballplayer3195 10 หลายเดือนก่อน

    you are my hero man, I've been using fixed array my whole life, you're best than my professors in college

  • @raba650
    @raba650 2 ปีที่แล้ว

    What a great walkthrough! Really enjoyed it. Now to binge on some more of your videos :)

  • @maryozonkwor-ei8vw
    @maryozonkwor-ei8vw 4 วันที่ผ่านมา

    Just what i am looking for. And u explain like swift and smooth . Tnx

  • @AnaCristina-ve7wh
    @AnaCristina-ve7wh หลายเดือนก่อน

    Thanks, you're a great teacher!! It's incredible how you can make it so easy to understand

  • @fridolinmeier661
    @fridolinmeier661 ปีที่แล้ว +1

    Just searched for a good video and wow I could not have found a better one. Thanks a lot.

  • @malodeity
    @malodeity 3 หลายเดือนก่อน

    I'll be the first to admit that I've been all over TH-cam but you different and you make it so easier to understand. Thanks

  • @lunarieu4815
    @lunarieu4815 7 หลายเดือนก่อน

    Literally I was crying after my class cause the teacher really did not explain as clear as this video. Honestly, thanks a million!🥰⭐

  • @EnfalOlgun
    @EnfalOlgun 4 หลายเดือนก่อน

    What a beautiful explanation. Stunning, absolutely stunning. Thank a lot John.

  • @AdrianTregoning
    @AdrianTregoning 2 ปีที่แล้ว

    Absolute gold. Very well explained! Thank you John.

  • @charmainemarasigan8994
    @charmainemarasigan8994 ปีที่แล้ว

    Superb training. Not boring! Very educational! Highly recommended

  • @s6031417
    @s6031417 ปีที่แล้ว

    This video took me only 17 mins to get fully understand the basic concept of Array and ArrayList.
    Thank you.

  • @TornadoeJoe
    @TornadoeJoe 2 ปีที่แล้ว +6

    Thanks for the help! Java is an interesting language so far, and this definitely helped me see things a bit better.

  • @user-ji4ym5lh6r
    @user-ji4ym5lh6r ปีที่แล้ว

    Im a student in south korea! Ive been having a hard time learnjng java on my own still im good at python or javascript! I love your java lectures. Thanks a lot!!!!

  • @daniella9498
    @daniella9498 5 หลายเดือนก่อน

    I'm using these videos to prepare for my first year Java course. Thank you so much!

  • @mohamedmada4159
    @mohamedmada4159 2 ปีที่แล้ว

    Glad that you've mentioned that ArrayList do so much behind the scenes, I'd have loved to see you go more in depth regarding the difference in speed and how they really work at a lower level, But again as you said the difference between both is barely noticeable.
    Thanx dude keep at it

  • @matiasmoresi5040
    @matiasmoresi5040 ปีที่แล้ว

    Hey John! Thank you very much for taking the time to teach like this

  • @saudaminisawant961
    @saudaminisawant961 หลายเดือนก่อน

    Excellent explanation of concepts ....great John

  • @HatTrick4030
    @HatTrick4030 ปีที่แล้ว

    Awesome!! as a refresher I alwasy have to come back and re-study the already-studied topics. Thanks for this great video

  • @patrykgwardzik4509
    @patrykgwardzik4509 ปีที่แล้ว

    Man i just love you so much. This is so clear and understandable.

  • @JuliusIkebiagbo
    @JuliusIkebiagbo ปีที่แล้ว

    YOU ARE MY NEW TEACHER RIGHT NOW ON TH-cam. I WANT TO SET MYSELF ON A MISSION TO WATCH ALL YOUR JAVA VIDEOS! WELLDONE!!!

  • @abdullahpopalzai6543
    @abdullahpopalzai6543 2 ปีที่แล้ว +1

    Please do not stop teaching, you are great!!!!!!

  • @jordans3611
    @jordans3611 ปีที่แล้ว

    Keep this up man, your videos are helping me so much!

  • @alessioharo7995
    @alessioharo7995 ปีที่แล้ว +1

    You're such a great teacher. Thank you for what you do! I love your videos

  • @Av-fn5wx
    @Av-fn5wx 5 หลายเดือนก่อน

    Brilliantly explanation. Clear and concise ❤

  • @jorgegutierrez2100
    @jorgegutierrez2100 2 ปีที่แล้ว +9

    Quality content, great at teaching, quality video and the most important for me is that as a non native English speaker I can perfectly understand everything you're saying. This channel deserves at least 1 million subscribers and hundreds of thousands views. Keep it up, man. 🥂

  • @AsrorkhanProgrammer
    @AsrorkhanProgrammer 2 ปีที่แล้ว

    In a simple case, a and very understandable prepared lesson Thank you, John

  • @sdaltnts6774
    @sdaltnts6774 3 ปีที่แล้ว +1

    Thank you very much John. You explained clearly. I love your channel.

  • @justinbanza4751
    @justinbanza4751 2 ปีที่แล้ว

    I really appreciated this video. Thanks for all the work to make it!

  • @kocovali7295
    @kocovali7295 4 หลายเดือนก่อน

    my english its not so good, but you speak so clearly so nice i understand everything in your videos. As an Java beginner i am very very thankfull to you!

  • @qararander
    @qararander ปีที่แล้ว

    Thanks. Your lessons are great. You simplify matters, you consider students cognition over showing your talent, which you undoubtedly have. Some teachers focus on proving their excellence more than a student’s need, level and ability.

  • @williamowusu7778
    @williamowusu7778 2 หลายเดือนก่อน

    Very helpful and easy to comprehend

  • @NajmaMiah
    @NajmaMiah ปีที่แล้ว

    Great explanation! Thank you. Please keep posting

  • @donnamadelene4594
    @donnamadelene4594 2 ปีที่แล้ว

    i love how you explained this rn and em crying co'z I really don't understand it at first. so yeah thank you so much john.

  • @kuldeepjoshi1
    @kuldeepjoshi1 3 หลายเดือนก่อน

    Great job John!!! Keep it up!

  • @javierherrero7011
    @javierherrero7011 ปีที่แล้ว

    John, you are an excellent excellent teacher....I have seen many of your Java videos, always learn fast and solid

  • @xiaoxiao717
    @xiaoxiao717 3 ปีที่แล้ว +10

    Very clear and detail, it really helps a lot! Will subscribe and hope to see more videos soon!

  • @nicholi8933
    @nicholi8933 ปีที่แล้ว

    This was super useful. I was forced to use an arraylist in this program and everything I was doing was not working. Though mine is a bit different since they are class objects, I figured it out with your help. Thank you so much. Arraylist remind me of arrays in python.

  • @nathanelliott9729
    @nathanelliott9729 2 ปีที่แล้ว

    Thank you so much, I learned more from this video than a 2 hour lecture from my professor.

  • @minakianrad812
    @minakianrad812 ปีที่แล้ว

    Thank you for this AWESOME video of the differences between arrays and arraysList. !!!! You explained it very clearly, down to the point, with great examples!!!! Thank you for making this video and sharing your knowledge and expertise with the world. You are Outstanding! Thanks again!
    And you also got a new subscriber! 🙂

  • @darthvasilis
    @darthvasilis ปีที่แล้ว

    Amazing. In 15 minutes I've learned more from you than I have in 10 weeks from my CSC205 professor...

  • @sambhavkumath
    @sambhavkumath ปีที่แล้ว +1

    thanks for making such an awesome lecture. hoping for more such tutorials

  • @FelipeGomesProfessor
    @FelipeGomesProfessor ปีที่แล้ว

    Great content!! Really easy to understand for a beginner. Thanks!

  • @moabdellatif5699
    @moabdellatif5699 2 ปีที่แล้ว

    just perfect and simple, thank you John

  • @ismetince
    @ismetince 2 ปีที่แล้ว

    Please make more videos. I really like your teaching style. Thanks...

  • @SkyeVintorez
    @SkyeVintorez 2 ปีที่แล้ว +1

    i love all your videos! it helps a lot and explained very well.. please keep on making videos about java..

  • @thekevinfx-krouxer
    @thekevinfx-krouxer 3 ปีที่แล้ว +1

    English is not even my first language but I understood most of the things you said, this is pretty helpful, you will be big one day

  • @sweetshoez
    @sweetshoez 11 หลายเดือนก่อน

    Thanks again this is exactly what I needed coming from more user-friendly languages

  • @kotyo82
    @kotyo82 ปีที่แล้ว

    wooow ,very clean and understandable explanation all , thanks for sharing with us

  • @aravindhkumar69
    @aravindhkumar69 ปีที่แล้ว

    You are really superman.. Because your video helpful to everyone... I saw a video from tamilnadu in south India....... Your are my best teacher

  • @user-ur3gr2qs6i
    @user-ur3gr2qs6i 2 ปีที่แล้ว

    Thanks for the videos, they are really easy to follow. Great for review of core concepts as well as an intro for those just learning Java, you and Carl do good work!

    • @CodingWithJohn
      @CodingWithJohn  2 ปีที่แล้ว

      I get lots of help from Carl and the cats

  • @valerietremblay3235
    @valerietremblay3235 2 ปีที่แล้ว

    Thank you so much for these clear & concise videos!

  • @aadi.p4159
    @aadi.p4159 3 ปีที่แล้ว +1

    clean precise and too the point.. big ups bro

  • @mariacunha8508
    @mariacunha8508 2 ปีที่แล้ว +1

    Really enjoying your videos!!! Keep it up!! Thank you!!!!

  • @rashmikadeshan2710
    @rashmikadeshan2710 ปีที่แล้ว

    Thank you so much for making video like this. You explained the difference between arrays and arrylist very clearly .therefore i could understand it. keep up th good work.❤️

  • @wjvos4
    @wjvos4 2 ปีที่แล้ว

    That was great, you really illuminated some stuff

  • @aashishgupta9392
    @aashishgupta9392 ปีที่แล้ว

    love from India bro....u know exactly how to teach....just amazing