Getters and Setters Java Tutorial #84

Поделиться
HTML-код
  • Опубликовано: 29 дек 2024

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

  • @alexlorenlee
    @alexlorenlee  Год назад +5

    If you’re new to programming but want a career in tech, I HIGHLY RECOMMEND applying to one of Springboard’s online coding bootcamps (use code ALEXLEE for $1,000 off): bit.ly/3HX970h

  • @magicvibrations5180
    @magicvibrations5180 5 лет назад +423

    My professor is useless. Thank you for this video, I needed it.

    • @4seth
      @4seth 3 года назад +28

      It's not always that they are useless, but the curriculum puts constraints on how effective of teachers they can be.

    •  3 года назад +14

      Exactly. My course is teaching me the same thing in 4 hours and I don't get it at the end of it plus feeling like a stupid. And he literally teach perfectly in 15 minutes. I don't know what else to say.

    • @thejamericanexperience2757
      @thejamericanexperience2757 3 года назад +14

      University is mainly for profit.

    • @magicvibrations5180
      @magicvibrations5180 3 года назад +2

      @@thejamericanexperience2757 Depends on the university

    • @mealsville
      @mealsville 3 года назад

      wouldn't agree more 😤

  • @soar01
    @soar01 5 лет назад +123

    Alex, please continue doing these tutorials. It helps me, and I'm sure a lot of others who want to extend their knowledge of Java.

  • @Sir_Sammi
    @Sir_Sammi 5 лет назад +304

    Just did my java final earlier this week, definitely would of failed without your videos, thanks for your good work!

    • @SubZeRoy9
      @SubZeRoy9 3 года назад +17

      Nice I did mine Monday. Alot better now that it's summer I feel like I'm going to learn alot more just doing my own stuff and making projects for fun. School has a way of sucking all the fun out of anything interesting. Lol

    • @eliasmore7500
      @eliasmore7500 2 года назад +5

      Would've

    • @hassansyed6087
      @hassansyed6087 Год назад

      What kind of example questions did you encounter? Could you show us 1 or 2? Just to see what they ask in a java exam =D

    • @derroz3157
      @derroz3157 Год назад

      its not work its a work of art you troll

  • @melodyosterholm3515
    @melodyosterholm3515 5 лет назад +77

    This man has just saved my schooling career!!

  • @jj-fe6hz
    @jj-fe6hz 3 года назад +2

    bruh, this video explained "this' better than any of the other 10-20min videos out there specifically trying to explain "this". THANK YOU

  • @rittenbrake1613
    @rittenbrake1613 4 года назад +4

    omg 13:01 the short cut is very useful ! Thank you Alex !!! Right click -->Source-->Generate Getters and Setters

  • @minhhuynh2646
    @minhhuynh2646 5 лет назад +48

    Thank you! I have been writing get, set for a month without knowing why and when to use lol. Thanks a lot

  • @teachernewteacher1944
    @teachernewteacher1944 5 лет назад +47

    Alex. You are so humble person. Great and easy explanations of all topics. Please give more exsamples for oop concepts, array, collections. (You may give exsamples from real life). I recommend you to my friends they are very glad to watch you. Respect. You do such a great job.

  • @ShadyChild12
    @ShadyChild12 4 года назад +40

    Getters/setters also allow you to perform actions on the input before setting/getting the variable, for example, you could change the setName to
    this.name = name.toUpperCase();
    This will set the variable to all caps. Getters/setters are very powerful when used correctly!

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

      cool, didnt know we could use .toUpperCase() with set, thankss

  • @Cablur
    @Cablur 2 года назад +3

    You are like a magician that casts a spell, and all of a sudden the fog is going away, making room for the sun to shine.
    My mind felt like clearing up while I was watching this awesome video of yours.
    There are many Java-related tutorial videos out there, but none of them have this talent to explain in such a clear and comprehensible way. Bonus points for your charismatic and charming charisma 😊😊

  • @christianek.963
    @christianek.963 3 года назад +5

    I have recently started to learn Java and when I saw him get excited by generating the getters and setters my heart skipped a beatt cause I'm used to that, but it's so cute when you see people get excited about things you already know or have. It makes me think of elderly who are surprised by all the new technologies

    • @davidm3614
      @davidm3614 3 года назад +2

      He already knew about it lol. He was just excited to tell us about it because its a great shortcut for beginners, not because he just learned it.

  • @kbt4115
    @kbt4115 3 года назад +4

    @Alex Lee All schools should have to pay a small dividend to you for students that passed their classes, but only did so because they watched your videos. You are a Java programming wizard in my book my man! Thanks for also stepping through how the compiler runs through the code. That really helped hit it home and tied it all together.

  • @freemanmusa1756
    @freemanmusa1756 2 года назад

    Hello Alex. My name is Freeman, from Nigeria. Just to let you know that your videos made great impact to my learning java. Thank you so much.

  • @minim4nches605
    @minim4nches605 Год назад +1

    I have a test next week and this video really helped me ty!

  • @Imluisx
    @Imluisx 5 лет назад +12

    You make java extremely simple without over complicating it! Appreciate the videos man!

  • @goldenraisins
    @goldenraisins 3 года назад +1

    I'm so grateful for all of Alex's YT videos haha

  • @dankBenk
    @dankBenk 10 месяцев назад

    You explained in 5 minutes what my professor couldn’t explain in 2 weeks, well done!

  • @DivingChipmunk
    @DivingChipmunk 5 лет назад +32

    Just learned this in my AP comp sci course, nice vid

  • @karaunderwood5821
    @karaunderwood5821 3 года назад +6

    Alex, your videos are incredibly helpful. You have a real knack for explaining confusing concepts in an extremely understandable and simple way. Thank you!

  • @abdallahalmanasrah6343
    @abdallahalmanasrah6343 Год назад +1

    I LOVE ALL YOUR VIDEOS! Thanks a lot

  • @bertjan1297
    @bertjan1297 4 года назад +2

    6:22 It doesn't confuse the computer (or rather the compiler). It simply sets the local variable 'name' to itself. By doing this it doesn't achieve the goal you want because the name of the scope variable and object variable are the same and the latest defined variable in the scope will always be used.
    On another note:
    Getters and setters are a lot of boilerplate code. Even for beginners I would suggest using something the like Lombok extension / plugin for Java. Creating something like the Account class in this video can then be done with:
    @Data
    public class Account {
    private String name;
    private int age;
    }
    That piece of code will have getters and setters and even equalization that is desired. At compile time it will be converted to normal Java code. Or if that is too much you can also use
    public class Account {
    @Getter @Setter
    private String name;
    @Getter @Setter
    private int age;
    }

  • @aa_2054
    @aa_2054 4 года назад +3

    I've watched hours of tutorials on RUclips but this one just clicked with me! Great job, good teacher 👍

  • @himanshunishad4080
    @himanshunishad4080 3 года назад

    Hey ! Alex, I am from India. This comment is to thanks you "This video help me to understand getter & setters easily" , also your bonus tip is just like you nailed it.

  • @ВладимирЧескидов
    @ВладимирЧескидов 2 года назад

    Great! The author decided from the very beginning to teach programmers what everyone has been trying to unlearn for about 15 years now: write accessor methods.

  • @feretiuti2550
    @feretiuti2550 2 года назад

    You are amazing. I thank God that you made this tutorial because not gonna lie, I need you in my life 💯

  • @AmoorTheContentCreator
    @AmoorTheContentCreator 4 года назад +1

    13:18
    If you are using NetBeans click (Alt + Ins) >> If you are using a LapTop like me, you will find (Ins) in the numbers pad on your right-hand side.

  • @khareek2453
    @khareek2453 5 лет назад +7

    Perfect explanations, easy to follow along. I can watch several of your videos and not get bored for even a second ❤

  • @epilepticmercenary9625
    @epilepticmercenary9625 3 года назад +2

    You are the organic chemistry tutor of programming. Thank you!

  • @WisdomofHal
    @WisdomofHal 4 года назад +1

    When my professor introduced our getters/setters lecture, I thought this was about to be a deep lecture in OOP theory. Come to learn, it was all about creating instance methods to return the state of an object or implement some action on it's state within a client program. I wanted to leave after 5 minutes. I'll say though, I'm glad you've gone over this and I think your video is about the right amount of time for any student to understand these fundamental concepts.

  • @jackiegura8161
    @jackiegura8161 3 года назад

    I havent seen any other tutorials that explain step by step of what you are doing and why. Thank you!! Youre the besttt

  • @AzgarthX
    @AzgarthX 3 года назад

    not that I didn't understand what setters and getters are for but I'm glad your youtube channel exists cause my java II professor barely teaches like this at all. Just gives us reading assignments and you basically gotta teach yourself the material

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

    You explained more in the first minute than my damn class and professor did this whole semester. Thank you!

  • @beyond_akshii
    @beyond_akshii 2 года назад

    i was so confused about the 'this' parameter but now i know ..........thank you alex for the precise info...love love

  • @Gamermatei
    @Gamermatei Год назад

    You are a live saviour, legit my teacher can't explain for the life of him

  • @thomasedwards7538
    @thomasedwards7538 4 года назад +1

    your videos are really helping me get through my university programming classes, thank you.

  • @KrigRaseri
    @KrigRaseri 2 года назад +2

    The last tip is a poggers moment.

  • @albertapremium3698
    @albertapremium3698 3 года назад +1

    Alex! thank you; i finally understand setters and getters after watching this :)

  • @prajakta_shinde_
    @prajakta_shinde_ 4 года назад +1

    My job depends on my java understandings.. I'm lucky I have your videos now..! Thankyou ^_^

  • @piumiwijenayake3953
    @piumiwijenayake3953 4 года назад +1

    Superb I couldn't understand this when my lecturer taught me but after seeing yours I can

  • @brotpapa2250
    @brotpapa2250 3 года назад +1

    Man, now everything makes sense...thank you so much for making these videos :)

  • @b.m.1022
    @b.m.1022 2 года назад

    Holy crap I'm glad I stuck around for the bonus tip! thanks for the video Alex

  • @rin3005
    @rin3005 2 года назад

    Okay since today you're my favorite kind person on earth 💐

  • @matthewerwine8333
    @matthewerwine8333 4 года назад +1

    I learned all of this through CS Awesome, but your vids had definitely clarified the details of java code and I thank you so much for it

  • @knr9686
    @knr9686 2 года назад

    big like for the bonus tip. That saves sooooo much time. Thanks! 🙏🏽🙏🏽🙏🏽

  • @minecompilation9373
    @minecompilation9373 4 года назад

    Without your video on how to learn java in 17 minutes I would never had picked up Java TY!

  • @umamaheshiyer5664
    @umamaheshiyer5664 3 года назад

    Alex I have watched many videos however you are the best !

  • @krishnanshudey3831
    @krishnanshudey3831 4 года назад +1

    You are the master of java. I really love your explanation at the end. Love from INDIA

  • @rezitec
    @rezitec 3 года назад

    Dude Thank you so muchhhh for create these videos 🥺❤️❤️ They don't teach us anything at uni . Your videos helped me a lot .Thank you wish you the bests 🙏🏻

  • @koushikghosh7048
    @koushikghosh7048 2 года назад

    That trick using Eclipse to generate the getters and setters was really neat!! Thank you!

  • @thewalkman4057
    @thewalkman4057 4 года назад +1

    I have never been to college so don't know how they teach java. But This guy did a great job for me !

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

    Alex is literally in a class of his own at teaching Java

  • @killerdwight8436
    @killerdwight8436 4 года назад +1

    Thank you very much. I was thinking it's gonna be very hard, but you're teaching very easy.

  • @klarakasprzyk6856
    @klarakasprzyk6856 5 лет назад +1

    You are awesome! i am studying CL and Java is my core subject atm and you really do make studying for my assignments easier! Thanks!

  • @Bhizchat
    @Bhizchat 4 года назад

    You don't know how much this has cleared for me

  • @Jerry-dq1zz
    @Jerry-dq1zz 3 года назад +1

    I'm currently taking this course and to have further knowledge, I watch your free videos. Thank you and please do create more!

  • @largibolala2691
    @largibolala2691 2 года назад

    i cant believe my course didn't have getters and setters explained and this is such a crucial topic!

  • @likarika3126
    @likarika3126 3 года назад

    My professor didnt explain this to us, but now i have u.

  • @katelynbradley9436
    @katelynbradley9436 2 года назад

    One of my favorite videos you've ever done. Thank you, Alex!!

  • @ZaRahula
    @ZaRahula 4 года назад +2

    I'm starting java this semester and I'm trying to wrap my head around OOP. Thank you sooo much So helpful!

  • @anees3934
    @anees3934 5 лет назад +14

    Such an hohroble person: you have a very special way to deliver your lessons:

  • @sssss3156
    @sssss3156 3 года назад

    ur videos + codegym = junior
    thank u

  • @timonmih84
    @timonmih84 3 года назад

    Finally, someone explained it to me. Thanks, Alex

  • @charlitolauronlapuz3879
    @charlitolauronlapuz3879 4 года назад

    your RUclips videos is the best Sir.. keep safe

  • @pedroyechilian3168
    @pedroyechilian3168 Год назад

    Damn, you explain better than my college techer, what a legend. Keep it up man

  • @marksummers463
    @marksummers463 2 года назад

    Thanks 4 making this really technical.I was so worried youd make this easy.

  • @SurajKumar-dz3zo
    @SurajKumar-dz3zo 4 года назад

    Thanks a lot ! I actually tried finding a video explaining this keyword and getter and setter for over 4 hours, and I found this now. You actually make concepts a lot easier to understand. And thanks again, I needed this for an assignment.

  • @hesham4744
    @hesham4744 2 года назад

    thank u i was a bit lazy to study but after i saw your vid

  • @dominiquegruter4115
    @dominiquegruter4115 4 года назад +1

    Alex!!! Thanks so much for all your videos! I've just started my Java course and your video's really help me out a lot!

  • @11suryanshtomar91
    @11suryanshtomar91 3 года назад +1

    thanks bro it helped me a lot to pass my exam thanks bro

  • @salinas718
    @salinas718 2 года назад

    Thanks a lot man! You're the best. I finally got this, been struggling with it for quite a while.

  • @blouberguy4647
    @blouberguy4647 Год назад

    amazing explaination and also very fast thank you for this!

  • @maaan8494
    @maaan8494 4 года назад +1

    Top notch lesson Alex, thanks

  • @artybe
    @artybe 4 года назад +1

    Now that I found the best explanation 👌 Thank you Alex so much 🙌🏼

  • @jesrealibabao6235
    @jesrealibabao6235 3 года назад

    No exaggeration, you really helped me a lot🤗

  • @TimmyGoesForTrip
    @TimmyGoesForTrip 4 года назад

    Couldn't understand the concept but gosh Thank You for the simple and clear explanation!!!

  • @armigeddon4451
    @armigeddon4451 5 лет назад +2

    THANK YOU SO MUCH! you're so much better than my current professor in university (no offense to him but I got so frustrated that I didn't get what he said because he keeps over complicating and over explaining his lessons that I got confused) but this is all the lesson had to say ;-;

  • @9chickenwingz
    @9chickenwingz 2 года назад

    Alex, you’re the teacher we needed! 👏🏽

  • @neira2607
    @neira2607 2 года назад

    not related to java but I LOVE LISTENING YOUR VIDEOS BECAUSE OF YOUR KEYBOARD TOO SO RELAXING (KEYBOARD ASMR)

  • @kakairecharles3474
    @kakairecharles3474 2 года назад

    million thanks, Alex. Your tuts have simplified my study life in Java.

  • @JTBanks
    @JTBanks 5 лет назад +3

    Thanks once again Alex, appreciate all you do for us here on RUclips. Very helpful! :)

  • @rosemarynyambura-n5n
    @rosemarynyambura-n5n Год назад

    am very very much impressed by this am 18 yrs of age thumb up for good work thanks a lo

  • @uwaishakim123
    @uwaishakim123 5 лет назад +2

    My finals is in few hours and this definitely helped me understand on why, where and when to use getter and setter. Thank you so much Sir 😭🙏🏻✨

  • @kennethcabarles4948
    @kennethcabarles4948 2 года назад

    Thanks for this! I've been able to complete my Performance Task. I appreciate you sir!

  • @lonewolf3623
    @lonewolf3623 5 лет назад +21

    Can you make a tutorial on abstract classes and interfaces

  • @lightningstrike2836
    @lightningstrike2836 3 года назад

    You are an actual lifesaver

  • @paulchristian1349
    @paulchristian1349 2 года назад

    thank you MR. lee you really help me a lot.

  • @youareiamurim
    @youareiamurim 5 лет назад +9

    Great video again!! 😊👍 But i wonder if you, in the future can make seperate class files for the methods etc...since that is actually how the program has to be stuctured. But by all means, love you videos!!❤

  • @its_Russel
    @its_Russel 4 года назад

    Im second year college BSIT i learned alot in your videos please make more videos...

  • @hellscream1265
    @hellscream1265 4 года назад

    Hey, just wanna say you're really awesome! Your tutorial really helps and its very easy to understand. My professor's teaching is nowhere near your teaching. I hope you continue to make these videos, thank you so much for these!

  • @zahoor.77
    @zahoor.77 Год назад

    Thank you. Your videos are beneficial!
    Grateful🙏

  • @viktoriaurban3178
    @viktoriaurban3178 4 года назад

    Alex you absolutely rock!

  • @princebismark3342
    @princebismark3342 2 года назад

    Thanks for really sharing , good work with us, am really appreciating the good effort you are putting in. Honestly I have understood the topic well.
    Thank you very much Lee

  • @milankbudha
    @milankbudha 4 года назад

    thank u alex lee..your teaching is simple and understanding

  • @dinithilakna9846
    @dinithilakna9846 4 года назад

    Thanks u. I Learned some cool tricks to generate getters and setters.😇

  • @nguyenkarma564
    @nguyenkarma564 2 года назад

    Thank you so much Alex. The best wish for you bro

  • @jacobbj
    @jacobbj 5 лет назад +1

    I'm grateful I found this channel. Thank you very much sir!
    I'll be more happy if you make a video for "Different Errors in Java programming and how to fix them" and "Shortcuts and the environment of Eclipse" (cause we can't edit in Photoshop without knowing it's tools right?)
    Thank you again sirr!

  • @villsy5768
    @villsy5768 4 года назад +1

    that shortcut at the end was absolutely insane lol thank you so much

  • @uzumakinaruto7991
    @uzumakinaruto7991 3 года назад

    the trick in the end was amazing

  • @manasdeshpande
    @manasdeshpande 4 года назад +1

    You really explain well ! May your channel grow ! Have a nice day ! best of luck !