Static vs Non-Static Variables and Methods In Java - Full Simple Tutorial

Поделиться
HTML-код
  • Опубликовано: 11 июн 2024
  • Struggling with static vs nonstatic in Java? You found the perfect video!
    ☕ Complete Java course: codingwithjohn.thinkific.com/...
    For beginner Java programmers, the concept of static vs nonstatic fields and methods can be incredibly confusing. I know it was for me!
    But it doesn't have to be difficult. We'll go over EXACTLY what the difference is, how they're used, and when you should make your methods and fields static or nonstatic in your programs.
    Learn or improve your Java by watching it being coded live!
    Hi, I'm John! I'm a Lead Java Software Engineer and I've been in the programming industry for more than a decade. I love sharing what I've learned over the years in a way that's understandable for all levels of Java learners.
    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
    📹Camera I use for recording:
    amzn.to/3wlXcmR
    🎙️Microphone I use (classy, I know):
    amzn.to/3AYGdbz
    Donate with PayPal (Thank you so much!)
    www.paypal.com/donate/?hosted...
    00:00 What Non-Static means
    03:34 What Static means
    05:53 Why can't I access my Non-Static variable?
    08:42 Using Static for Constants
    10:30 When to make something Static or Non-Static?
    ☕Complete Java course:
    codingwithjohn.thinkific.com/...
    codingwithjohn.com

Комментарии • 227

  • @a7mdbest15
    @a7mdbest15 4 месяца назад +29

    Anyone wants to learn java, this is the destination

  • @gunnerxt
    @gunnerxt 9 месяцев назад +104

    Hey John, I truly appreciate the way you explain concepts. There's one aspect I'd hope you cover: Serialization and Deserialization. Thank you for keeping up the good work. You make so many people want to code

  • @neon0wl2107
    @neon0wl2107 8 месяцев назад +19

    1:52 cleared a doubt i have been having for over 5 years. Thanks a lot.

  • @micleh
    @micleh 9 месяцев назад +31

    Just in the nick of time. My students are presently struggling with static and non static and this video might help them look at both concepts from yet another angle.
    Thanks again for your short but incredibly succinct videos.

  • @matiloki
    @matiloki 4 месяца назад +5

    My goodness, years using it without knowing how to explain this to other people. Now I can teach it. Thanks!!!

  • @kingslymatthew5586
    @kingslymatthew5586 9 месяцев назад +14

    Your contents are easy to follow & understand. Thanks John.✌🏼

  • @SupahBro535
    @SupahBro535 2 месяца назад +2

    Java was the one language I was intimidated and frustrated with, until I found your channel. Then it became my favorite language to work with!

  • @olivierbegassat851
    @olivierbegassat851 8 месяцев назад +5

    Those explanations are crystal clear ... You are an amazing teacher, and those lessons are invaluable 😃

  • @timmann109
    @timmann109 9 месяцев назад +2

    Best description I have seen on this topic. Thanks

  • @akshitmittal1251
    @akshitmittal1251 2 дня назад

    U have very POSITIVE vibe. There are v less people like u. Thanks for all tutorials

  • @AdrianTregoning
    @AdrianTregoning 9 месяцев назад +2

    Pure gold, that made it easy to understand. Thanks John.

  • @jessicar5549
    @jessicar5549 8 месяцев назад +1

    John. I just need to say I am so thankful I’ve run across your channel. Thank for educating us all!!!

  • @GabrielLima-yq6qp
    @GabrielLima-yq6qp 9 месяцев назад +22

    how did you know that i needed this video? your content is so amazing keep going

    • @CodingWithJohn
      @CodingWithJohn  9 месяцев назад +23

      I have eyes everywhere 👀

    • @erikseyranyan5490
      @erikseyranyan5490 6 месяцев назад

      Love you bro. You are the best teacher. Understand your videos are very easy your methods of teaching are the best@@CodingWithJohn

    • @muhammetalimutlu6748
      @muhammetalimutlu6748 4 месяца назад

      @@CodingWithJohn mr you are great thank you

    • @LANternFly1001
      @LANternFly1001 2 месяца назад

      @@CodingWithJohn I pray for your codiness Saint John.

  • @tshepisoseabi1069
    @tshepisoseabi1069 2 месяца назад

    You have no idea how long I've been struggling to understand this, thank you John.

  • @user-jc6es2ku6d
    @user-jc6es2ku6d День назад

    this is such a live saver for me, who was forced to jump from C to Java, and lost all motivation at the first days via confusion. Now with a better explained Theory and Concepts by you, @Josh, it is strarting to make sense and become understandable, and i also tend to like it more, eventhough i do bad with a little more abstract languages. thanks :)

  • @sgretsch
    @sgretsch 8 месяцев назад +7

    These lectures are the best ones that I've seen on the Internet, even compared with L/U big monsters. Not only knowledge, but hidden rocks that you can collide with, everything explained. Thanks to the author!

  • @Hassan-lv9di
    @Hassan-lv9di 6 месяцев назад

    Simplicity, straight forward, depth.. yep that's CodingWithJohn !
    I love you man! KEEP UP THE HARD WORKING

  • @srishtijoshi5980
    @srishtijoshi5980 2 дня назад

    Your examples are spot on. Its easy to understand the difficult concept when you explain it.

  • @raderadovanovic9052
    @raderadovanovic9052 9 месяцев назад +1

    Very nice explanation. Keep up with a good work John!

  • @magadiflo-dev
    @magadiflo-dev 9 месяцев назад +2

    He really has a simple and very understandable way of explaining these concepts. Thank you very much for sharing them. Greetings from Peru

  • @yte6598
    @yte6598 9 месяцев назад +11

    Finding your channel is luck for me! I had avoided to learn Java because of difference from any other language and stream of fearful keywords. But thanks to your teaching that anyone can understand and well-made examples in your videos and courses, I could understand what mean of keywords and how to code in Java. Not only that, I find attraction of Java and enjoy coding with it! I sincerely hope to see your videos more. Thanks!

  • @andyhicks3472
    @andyhicks3472 4 месяца назад

    This is the clearest explanation of static I have come across. Thank you!

  • @Kuba200411
    @Kuba200411 9 месяцев назад +21

    Hi John! Could you do some videos about design patterns like Singleton, and others?

  • @user-rm4oq9uh8j
    @user-rm4oq9uh8j 2 месяца назад

    John, you're the man!!! I have finished a bootcamp and learned core Java in 3 months from zero. Now, after a year, going through all the topics with your videos is perfecting my knowledge and making me feel more comfortable with things that I've learned. Your efforts in sharing your knowledge are very much appreciated!

  • @christo4520
    @christo4520 2 месяца назад

    Another amazingly explained concept man!!!

  • @davidorevic6651
    @davidorevic6651 6 месяцев назад

    Thank you so much John!I was questioning myself a lot regarding this matter 💥

  • @lucostz
    @lucostz 14 дней назад

    Super clear, thanks!

  • @mayurpatel481
    @mayurpatel481 7 месяцев назад

    It was very nicely explained. Thanks John.

  • @Hianfita
    @Hianfita 3 месяца назад

    Best explanation I've ever heard! Thanks a lot!!!!

  • @kevinkoomson7873
    @kevinkoomson7873 Месяц назад

    This is gold. Thanks John

  • @rachiimade4073
    @rachiimade4073 2 месяца назад

    it was a very clear explanation ,thank for your efforts for making this get sence.

  • @solvejtodd2960
    @solvejtodd2960 12 дней назад

    THE Best explanation of this on the internet.

  • @lemagamy
    @lemagamy 9 месяцев назад

    great video John, your yt channel and videos are amazing!

  • @TerryPlays
    @TerryPlays 9 месяцев назад

    Great to see you back with a new video! Thanks

  • @donaldbunce2741
    @donaldbunce2741 5 месяцев назад

    John, this is an excellent explanation! I'm grateful.

  • @shaygoldin
    @shaygoldin 9 месяцев назад

    Hi John. thank you so much! your videos are truly the best!

  • @thiagogo1995
    @thiagogo1995 5 месяцев назад

    Great video! Very easy to understand. Thank you very much.

  • @user-qw6dy5tg8j
    @user-qw6dy5tg8j 5 месяцев назад

    That was very informative, thanks a lot

  • @Carll19
    @Carll19 2 месяца назад

    Before your video, I felt the same, now finally ‘static’ is clear for me, thanks!

  • @kraxmalism
    @kraxmalism 6 месяцев назад

    it is no longer confusing after this video. appreciated!

  • @mathewajayi2482
    @mathewajayi2482 5 месяцев назад

    ❤ Thank you for this...the concept is so much simpler.

  • @Do11an
    @Do11an 2 месяца назад

    Perfect video, thank you!

  • @muhannadFahmy
    @muhannadFahmy 8 месяцев назад

    It is sooo clear, thanks to you

  • @sandra_witch
    @sandra_witch 5 месяцев назад

    You're a great teacher, thank you so much!

  • @amaralensheriff
    @amaralensheriff 5 месяцев назад

    Awesome John, please keep on doing more such great contents.

  • @gaetanolopez7779
    @gaetanolopez7779 3 месяца назад

    I utilized your content as a reference for my university assignment, citing it in APA format. Your material was incredibly helpful, simplifying complex concepts for easy comprehension. Hopefully, the university won't find any issues with my referencing!

  • @codeZarathustra
    @codeZarathustra 8 месяцев назад

    Thanks very much Jhon.

  • @Sagittarius182
    @Sagittarius182 2 месяца назад

    Very nice explanation. Thank you very much 😸👌

  • @julie3447
    @julie3447 7 месяцев назад

    I like how u make it so simple. thank u so much

  • @paulthomas1052
    @paulthomas1052 9 месяцев назад

    Very useful video as usual - cheers !

  • @gabrielfono844
    @gabrielfono844 4 месяца назад

    Sir
    I am going to lie
    you are absolutely amazing.
    I taught programming 3 years ago and I have been working professionally for almost two years.
    always your videos are amazing.
    Thanks so much.

  • @JuanRamirez-fx3tf
    @JuanRamirez-fx3tf 9 месяцев назад

    Evening John, I've been following you since I started a Java course this summer. I've finished a project using static, I use the concept, but I do no know why. I am going to enjoy this video.

  • @jonathan2350
    @jonathan2350 4 месяца назад

    Thanks, understood it!

  • @Askalon08
    @Askalon08 7 месяцев назад +3

    Can you pls make a video about modules in Java? ur the best❤

  • @yashsureka9552
    @yashsureka9552 3 месяца назад

    you teach so difficult concepts so easily

  • @farah2521
    @farah2521 8 месяцев назад

    Thank you so much! This helped so much

  • @davod9638
    @davod9638 7 месяцев назад +4

    Hey John,
    Can you make a video about Java modules? Really important, thank you. You are the best!

  • @bytecode5834
    @bytecode5834 8 месяцев назад

    Very helpful, many thanks!

  • @jayt675
    @jayt675 4 месяца назад

    Extremely helpful.

  • @cisco8237
    @cisco8237 9 месяцев назад

    Thanks for the video really helped me

  • @laali_puppy
    @laali_puppy 9 месяцев назад

    Great explanation, thanks a lot!

  • @felipel.r.637
    @felipel.r.637 9 месяцев назад

    Brilliant as always, thank yu very much

  • @axmy1776
    @axmy1776 8 месяцев назад

    Thank you so much John!

  • @expekeyt2998
    @expekeyt2998 9 месяцев назад

    Thank you for your teaching!

  • @ryyyyy2010
    @ryyyyy2010 7 месяцев назад

    very helpful video. tysm

  • @wasim_17
    @wasim_17 8 месяцев назад

    Nice explanation.

  • @yoyomaster223
    @yoyomaster223 4 месяца назад

    Relearning Java right now after close to 8 years never touching it. I remember never understanding what static meant and how it was used. Gave me so much grief trying to figure it out. Been debugging a few if statements today for close to 5 hours, come to find out it had to do with needing a static declaration.
    Long story short, found this video and everything finally made sense! Thank you!

  • @Ironman-sn4ct
    @Ironman-sn4ct 6 месяцев назад +1

    Hey Sir! I am from India and I am learning java by watching your videos ❤❤ Thank you Sir 😊😊

  • @personalaccount1515
    @personalaccount1515 9 месяцев назад

    Hi. I really love all your videos, PLS keep doing it,. Thanks for everything,

  • @MooseAntlers-ym4de
    @MooseAntlers-ym4de 2 месяца назад

    WHY ARE YOUR VIDEOS SO GOOD AND EASY TO UNDERSTAND DO YOU KNOW HOW MANY PEOPLE YOU HAVE SAVED THANK YOU SO MUCH 🙏🙏🙏🙏🙏🙏🙏

  • @anghamjbeli3037
    @anghamjbeli3037 8 месяцев назад

    great explanation

  • @vogiansatnaaihonglien6780
    @vogiansatnaaihonglien6780 9 месяцев назад

    Thanks a lot for your video! Tbh i was stuck with the same problem of not able to access the rest controller class in Spring since non-static class and method cannot be access without instantiated, so after i watched your video i went to look back at some information and found out that you can just autowired the class object from the beginning :v
    You really helped me pointing out the vagueness of my understanding about all this static non-static thing, thank you!

  • @armenuhiyeghoyan5419
    @armenuhiyeghoyan5419 26 дней назад

    Your English is perfect.The best one for me to develop speaking skills.

  • @SUMITYADAV-cy9hf
    @SUMITYADAV-cy9hf 3 месяца назад

    hey John !!! amazing work requesting you to create a spring framework course as well .

  • @user-rm1cq1kx4b
    @user-rm1cq1kx4b 8 месяцев назад +1

    This is a very good video. I used to abuse the "static" keyword, and it caused so many bugs that I am only now beginning to understand 3 years into my coding. Lol

  • @cvl--
    @cvl-- 9 месяцев назад +2

    I've learned by the terms "static"/"instance" when talking about methods and variables. I think it is less confusing than static or non-static, specially for beginners.

  • @beetsreliable
    @beetsreliable 4 месяца назад

    Very helpful!

  • @bioblade87
    @bioblade87 8 месяцев назад

    Someone told me that Static is the same as the "Shared" keyword in VB. Calling it "Shared" instantly made sense to me as opposed to "Static".
    Goes without saying, great video and breakdown of the topic.

  • @dayshiasweet
    @dayshiasweet 8 месяцев назад

    Amazing explanation

  • @Leetneetcode1729
    @Leetneetcode1729 9 месяцев назад

    much needed thanks very cool

  • @Aporajita_.29
    @Aporajita_.29 3 месяца назад

    I'm in 10th grade rn and this video of yours has helped me alot
    Thank you John

  • @DejiAdegbite
    @DejiAdegbite 6 месяцев назад

    Here's me shouting at you in the comments: GREAT VIDEO. I LOVE THAT YOUR VIDEOS ARE SHORT, SIMPLE AND STRAIGHT TO THE POINT. 😄

  • @Mirtguitar
    @Mirtguitar 6 месяцев назад

    Great tutorial

  • @Avinash-fm6we
    @Avinash-fm6we Месяц назад

    It was a very good video for anyone to understand Static vs Non-Static Variables and Methods In Java.

  • @andreperez5850
    @andreperez5850 9 месяцев назад

    Glad to see you again sir

  • @domnulpufosila434
    @domnulpufosila434 6 месяцев назад

    You have my like, not because you explain this concept so well, cause you do. But because of the way you "miau".

  • @johnandrewbotros8972
    @johnandrewbotros8972 9 месяцев назад

    your channel is very helpful i learned so much from it keep uploading

    • @CodingWithJohn
      @CodingWithJohn  9 месяцев назад

      I don't get to as often as I'd like but I'll keep it going!

  • @KARTIKKUMAR-vm8ht
    @KARTIKKUMAR-vm8ht 8 месяцев назад

    Hey jhon, i have seen most of your videos on java and they are good. I have a request Please make videos on spring and spring boot as well

  • @zladtv1456
    @zladtv1456 6 месяцев назад

    Very useful!

  • @Goooogle
    @Goooogle 8 месяцев назад

    You are a good teacher

  • @bumilib9785
    @bumilib9785 8 месяцев назад

    you're the best! thanks

  • @SupahBro535
    @SupahBro535 2 месяца назад +1

    Literally better than all my comp sci profs

  • @fathimasalooja
    @fathimasalooja Месяц назад

    awesome,Thank you.

  • @minfiresmanyeah
    @minfiresmanyeah 7 месяцев назад

    Thank you!!

  • @dzeremi1625
    @dzeremi1625 19 дней назад +1

    nice, goated explanation

  • @mohammadbayat1635
    @mohammadbayat1635 4 месяца назад

    Wow, thanks John

  • @kokosensei5231
    @kokosensei5231 5 месяцев назад

    Thank you!

  • @shahabshafiee3333
    @shahabshafiee3333 9 месяцев назад

    Best Java channel ever.

  • @Fernandoo1337
    @Fernandoo1337 5 месяцев назад

    goat of explanation, tks!!!!!

  • @JoseFranc
    @JoseFranc 8 месяцев назад

    Thank you so much