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

Поділитися
Вставка
  • Опубліковано 21 лис 2024

КОМЕНТАРІ • 290

  • @a7mdbest15
    @a7mdbest15 9 місяців тому +103

    Anyone wants to learn java, this is the destination

  • @stingray-q5p
    @stingray-q5p Рік тому +130

    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

  • @sangjunlee8200
    @sangjunlee8200 День тому +1

    Great content. I'm a non-native but this video was very easy to follow. Nice pronunciation, big fonts, easy-to-understand examples... UA-cam needs more videos like this

  • @neon0wl2107
    @neon0wl2107 Рік тому +41

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

  • @micleh
    @micleh Рік тому +44

    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.

  • @lootster
    @lootster 5 місяців тому +8

    This 11 mins video probably saves you HOURS of research on the internet what the keyword Static means, you're the best John! 👏

  • @SupahBro535
    @SupahBro535 7 місяців тому +5

    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!

    • @toby9999
      @toby9999 2 місяці тому +1

      I'm in the same boat, but I'm transitioning from 30 years as a C++ developer. My brain is a little too old and stuck in the C++ mindset.

  • @matiloki
    @matiloki 10 місяців тому +8

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

  • @yoyomaster223
    @yoyomaster223 9 місяців тому +2

    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!

  • @tshepisoseabi1069
    @tshepisoseabi1069 7 місяців тому +2

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

  • @HasanSahin-n8d
    @HasanSahin-n8d 7 місяців тому

    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!

  • @SacharMolotov
    @SacharMolotov 5 місяців тому +1

    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 :)

    • @lazeatscrayons2426
      @lazeatscrayons2426 Місяць тому

      lol, I've become so accustomed to using the C language that learning Java has been such a headache, glad this man exists

  • @gabrielfono844
    @gabrielfono844 9 місяців тому

    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.

  • @timmann109
    @timmann109 Рік тому +3

    Best description I have seen on this topic. Thanks

  • @philb4462
    @philb4462 Місяць тому

    This is fantastic. "Static" has puzzled me for a long time. This is a very clear explanation. Thank you.

  • @yte6598
    @yte6598 Рік тому +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!

  • @Shamim-oh8rw
    @Shamim-oh8rw 10 місяців тому

    I'm from lran and I don't know English pretty much but you speak simply and I understand it keep going my friend ❤

  • @bioblade87
    @bioblade87 Рік тому

    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.

  • @sgretsch
    @sgretsch Рік тому +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!

  • @akshitmittal1251
    @akshitmittal1251 5 місяців тому +1

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

  • @TimHonisett-m1x
    @TimHonisett-m1x 2 місяці тому

    Went back to this video and it didn't disappoint! Clear and straight to the point

  • @petrliszok9519
    @petrliszok9519 Рік тому +2

    wow... In my 33, I am trying ro change my career and learn to code and your videos are literally saving my a...! :)

  • @kingslymatthew5586
    @kingslymatthew5586 Рік тому +16

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

  • @Ironman-sn4ct
    @Ironman-sn4ct 11 місяців тому +1

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

  • @andyhicks3472
    @andyhicks3472 10 місяців тому +1

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

  • @cvl--
    @cvl-- Рік тому +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.

  • @gaetanolopez7779
    @gaetanolopez7779 9 місяців тому

    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!

  • @Carll19
    @Carll19 8 місяців тому

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

  • @DejiAdegbite
    @DejiAdegbite 11 місяців тому

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

  • @olivierbegassat851
    @olivierbegassat851 Рік тому +6

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

  • @Kuba200411
    @Kuba200411 Рік тому +21

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

  • @GabrielLima-yq6qp
    @GabrielLima-yq6qp Рік тому +26

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

    • @CodingWithJohn
      @CodingWithJohn  Рік тому +25

      I have eyes everywhere 👀

    • @erikseyranyan5490
      @erikseyranyan5490 11 місяців тому

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

    • @muhammetalimutlu6748
      @muhammetalimutlu6748 10 місяців тому

      @@CodingWithJohn mr you are great thank you

    • @LANternFly1001
      @LANternFly1001 8 місяців тому

      @@CodingWithJohn I pray for your codiness Saint John.

  • @eyupdeli7860
    @eyupdeli7860 3 місяці тому

    you literally made everyting crystal clear in my mind, thanks a lot

  • @srishtijoshi5980
    @srishtijoshi5980 5 місяців тому

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

  • @ArmenianGenXGuy
    @ArmenianGenXGuy Рік тому +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

  • @SupahBro535
    @SupahBro535 7 місяців тому +1

    Literally better than all my comp sci profs

  • @Hassan-lv9di
    @Hassan-lv9di 11 місяців тому

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

  • @growmoreyt4192
    @growmoreyt4192 4 місяці тому

    This clears everything about static and non-static.

  • @armenuhiyeghoyan5419
    @armenuhiyeghoyan5419 6 місяців тому

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

  • @AdrianTregoning
    @AdrianTregoning Рік тому +2

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

  • @Aporajita_.29
    @Aporajita_.29 8 місяців тому

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

  • @magadiflo-dev
    @magadiflo-dev Рік тому +2

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

  • @gnair9064
    @gnair9064 Рік тому

    Hi john, i was working as a junior java developer 10 years ago. Due to the lack if child care u could nit get back to work. But now am trying to get back to work. Can you please give me aome advice so i can kick start. I watch your videos and am so grateful for all those vidoes. Please keep posting

  • @الهدىهدىالله-ش7ي
    @الهدىهدىالله-ش7ي 2 місяці тому

    Clear and beautiful explanation. Thanks

  • @lszujo
    @lszujo 2 місяці тому

    Java makes sense to me,it's just logical...more than Python ever did....I enjoy your tutorials.great job!Thanks!

  • @kraxmalism
    @kraxmalism 11 місяців тому

    it is no longer confusing after this video. appreciated!

  • @davod9638
    @davod9638 Рік тому +4

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

  • @yashponam1055
    @yashponam1055 4 місяці тому +2

    Watching the whole series as a preparation for interviews

  • @MooseAntlers-ym4de
    @MooseAntlers-ym4de 7 місяців тому

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

  • @solvejtodd2960
    @solvejtodd2960 5 місяців тому

    THE Best explanation of this on the internet.

  • @Askalon08
    @Askalon08 Рік тому +3

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

  • @jessicar5549
    @jessicar5549 Рік тому +1

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

  • @JuanRamirez-fx3tf
    @JuanRamirez-fx3tf Рік тому

    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.

  • @Ivan-kh3gn
    @Ivan-kh3gn Рік тому +1

    Hey John!
    I've got a question for you 🙃
    My java teacher told me that using the keyword break anywhere but in switch() is a bad practise. Why is that?
    It works fine in any loop and I've always used it that way.
    Could that be a subject for new video? Or perhaps an answer to this comment x)
    Love your videos! You really are great explaining :)
    Thanks!

  • @yashsureka9552
    @yashsureka9552 8 місяців тому

    you teach so difficult concepts so easily

  • @skullknightyt
    @skullknightyt 2 місяці тому

    After watching this video, wow just wow. You managed to explain better than my professor

  • @noumansaiyed343
    @noumansaiyed343 3 місяці тому

    Amazing explanation 🎉I clear my doubt after watching this video

  • @phoenixaki3458
    @phoenixaki3458 Рік тому +1

    As a Java instructor who literally just today tried and failed to explain static/nonstatic to people, I wish I had seen this released hours before my class, I could've just played it instead 😂 I think on its own it's not a difficult concept, it just requires good examples and is much harder to explain with just words alone.

  • @domnulpufosila434
    @domnulpufosila434 11 місяців тому

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

  • @Avinash-fm6we
    @Avinash-fm6we 7 місяців тому

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

  • @chaitanya.g-4531
    @chaitanya.g-4531 3 місяці тому

    THANKS JHON! ur class was amazing.

  • @aryehabowitz2321
    @aryehabowitz2321 3 місяці тому

    amazing video very clear and articulate which is needed to understand this concept

  • @ahmedbilal018
    @ahmedbilal018 3 місяці тому

    best explanation so far

  • @Hianfita
    @Hianfita 8 місяців тому

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

  • @Luizanbrg
    @Luizanbrg Місяць тому

    This video is amazing and very easy to understand ! Thank you

  • @Josuke217
    @Josuke217 Місяць тому

    You are goated , I love Java. This is truly the best place to learn it

  • @rachiimade4073
    @rachiimade4073 7 місяців тому

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

  • @darkojitsu
    @darkojitsu 10 місяців тому

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

  • @prashantbharti2650
    @prashantbharti2650 11 місяців тому

    Such simple and accurate concepts should be present for all blooming buds😇

  • @christo4520
    @christo4520 8 місяців тому

    Another amazingly explained concept man!!!

  • @NalbertWattam
    @NalbertWattam Рік тому

    What about static/non-static methods and variables in a Spring environment, where there's @Component, @Service, @RestController, etc?
    Prime work as always!

  • @davidorevic6651
    @davidorevic6651 Рік тому

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

  • @iddiramadhani5111
    @iddiramadhani5111 3 місяці тому

    This is real well understood, thanks bro.

  • @mayurpatel481
    @mayurpatel481 Рік тому

    It was very nicely explained. Thanks John.

  • @nihill4048
    @nihill4048 Рік тому

    usage of static fields inside the constructor and accessing them through getter method is the key point for me in this video.. sometimes i try to access fields directly 😂 thank you for alarming my senses

  • @BinaryBytes007
    @BinaryBytes007 9 місяців тому +1

    Nice video but what version of intellij are you exactly using like my one is pretty different from yours can you please mention 😅

  • @vogiansatnaaihonglien6780
    @vogiansatnaaihonglien6780 Рік тому

    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!

  • @shahabshafiee3333
    @shahabshafiee3333 Рік тому

    Best Java channel ever.

  • @Jyotigupta-vs4mz
    @Jyotigupta-vs4mz 12 днів тому

    ❤😘I'm shouting out that you clear this concept to me and moreover thanks for saying it's confusing because I was frustrated before

  • @rudranighoshroy8412
    @rudranighoshroy8412 3 місяці тому

    I was working on Token Management and this asaved me :)

  • @helloworld4147
    @helloworld4147 Рік тому

    John- the God of coding!

  • @gajananmahajan1081
    @gajananmahajan1081 9 місяців тому

    John, could you please create a video on Comparator and Comparable in Java?

  • @jerrygord3131
    @jerrygord3131 5 місяців тому

    This was extremely helpful, thank you so much!

  • @cyberkiller83
    @cyberkiller83 Рік тому

    Hi john, as always, amazing video. You miss two things thought.
    1 Miss to mention that when you create static members of a class, the system automatically make those instances one they are used the first time.
    2 MIss to mention the static code blocks static { } and how this code blocks are called the first time a static member is called, so those can be used like some kind of constructor.
    Great videos!

  • @icjay1793
    @icjay1793 11 місяців тому

    what project should i developed ? im a begginer on java

  • @mathewajayi2482
    @mathewajayi2482 10 місяців тому

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

  • @thiagogo1995
    @thiagogo1995 10 місяців тому

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

  • @sandra_witch
    @sandra_witch 10 місяців тому

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

  • @Goooogle
    @Goooogle Рік тому

    You are a good teacher

  • @kevinkoomson7873
    @kevinkoomson7873 6 місяців тому

    This is gold. Thanks John

  • @julie3447
    @julie3447 Рік тому

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

  • @gonenikhil8189
    @gonenikhil8189 8 днів тому

    Thank you! this video worked for me

  • @raderadovanovic9052
    @raderadovanovic9052 Рік тому +1

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

  • @KARTIKKUMAR-vm8ht
    @KARTIKKUMAR-vm8ht Рік тому

    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

  • @lootster
    @lootster Рік тому

    There's nothing to shout except to praise! LIKE!

  • @valentrix
    @valentrix Рік тому

    so is it correct if i say static variables go with static methods, and non-static variables go with non-static methods, like we can't combine them? (very good tutorial

  • @lucostz
    @lucostz 5 місяців тому

    Super clear, thanks!

  • @dayshiasweet
    @dayshiasweet Рік тому

    Amazing explanation

  • @GurudattaPraharaj
    @GurudattaPraharaj 10 місяців тому

    Good explanation.
    But We also need to consider Threads before declaring global variables static / non static

    • @toby9999
      @toby9999 2 місяці тому

      Only when multithreading. But that's too advanced for this video, right?

  • @Meenimie
    @Meenimie 2 місяці тому

    This was helpful. Thank you.