Java Tutorial #8: Getters and Setters Explained

  Рет қаралды 107,507

CodingWithChandler

CodingWithChandler

Күн бұрын

Пікірлер: 131
@LNasterio
@LNasterio 4 жыл бұрын
3:05 THANK GOD finally someone explained this in few seconds instead of paragraphs
@dapro3495
@dapro3495 3 жыл бұрын
yep right i always wondering what "this" actually means
@jonker5096
@jonker5096 3 жыл бұрын
I just wanted to agree with everyone here; this is way better than anything my school has showed me for this subject. I no longer have any confusion or questions and I understand why you would want to use this method (I initially thought my school was just making things harder for no reason). Thank you :)
@ezramukisa376
@ezramukisa376 2 жыл бұрын
Wow, imagine. I'm at uni but it has never been as easy to understand as this 8 minute video. This deserves a million subscribers 🙌
@zukiezuke
@zukiezuke 2 жыл бұрын
I spent a while searching and this is the best AND most straightforward explanation out there I could see. Thank you so much, I feel like I actually get it when at this point I was willing to settle for someone just telling me what to do.
@MehranHosseini-po9eg
@MehranHosseini-po9eg 5 жыл бұрын
what a really good point you mention that freed my mind and it was Setter should be before Getters, cause it makes more scenes in this form. Btw I'm aware it's not really that important to cause a problem if in reverse but for learning purpose it's better in this way
@rudiminnaar3700
@rudiminnaar3700 5 жыл бұрын
Perfect video for learning or doing quick revision. Thanks Chandler!
@omarkurdi9381
@omarkurdi9381 3 жыл бұрын
I literally can't thank you enough i watched all the you tube vids about learning java setters and getters and yours is the best one i understood the use of them finally thanks alot
@minyoi6843
@minyoi6843 4 жыл бұрын
Thanks a million. Most video go back and forth I couldn't really understand. This is the first time I've understood getters and setters.
@MrChester197
@MrChester197 2 жыл бұрын
I just found your channel by searching this topic. You have explained this so much better than anyone else, including my professor. I also learned about the generate feature on IntelliJ and my mind is blown. thank you SO MUCH.
@habibazarsina5857
@habibazarsina5857 4 жыл бұрын
Thanks, Chandler. You are a great teacher/tutor. After watching your video I have a better understanding of setters and getters in Java.
@jameskerester2000
@jameskerester2000 4 жыл бұрын
At 3:06 isn't the instance variable the one on the left? So if you weren't using this.name = name it would be name = Name right?
@abdelwadoud1040
@abdelwadoud1040 8 ай бұрын
you are right
@maurosgarage
@maurosgarage 5 жыл бұрын
Thank you!!!!! I wrote 157 lines of code to do what you did in 10 line of code #overthinking
@anidh1503
@anidh1503 5 жыл бұрын
Simple and well explained, thanks for the vid
@taylorsmith5461
@taylorsmith5461 5 жыл бұрын
Such a well done video! I'm thankful that you did the getters and setters the way you did because I finally understand them better. Everything is well explained. Keep up the great work!
@SuperDaxos
@SuperDaxos 5 жыл бұрын
I'm in school and yesterday my teacher was explaining a course that also contained getters and setters, and I didn't understand sh*t. In these 8 minutes of your video, I'm like: holy cow, this is actually really easy. I just needed someone to explain it well and take it slow
@markellis130
@markellis130 5 жыл бұрын
Great video! This was much easier to understand than my textbook.
@tharakhgormaniad9820
@tharakhgormaniad9820 2 жыл бұрын
THANK U SO MUCH!!! THIS IS WHAT I NEEDED A SIMPLE AND CLEAR EXPLANATION U SAVED MY LIFE
@brandontaylor8372
@brandontaylor8372 5 жыл бұрын
You described this way better than my professor. Thank you!
@omarkurdi9381
@omarkurdi9381 3 жыл бұрын
dude same i didn't understand a word from my professor
@anedz4005
@anedz4005 5 жыл бұрын
thanks, my teacher wasnt able to explain it to me but you did a great a job and now I understand it thanks a lot!
@adrianlowery7175
@adrianlowery7175 2 жыл бұрын
THANK YOU for explaining the concept so simply. That is what makes a great teacher. And thank you for showing shortcuts! I had no idea that IntelliJ would generate getters and setters.
@sheed419
@sheed419 2 жыл бұрын
WOW!!! I was having problems with getters and setters until I came across this video... thanks girl!!!!
@DeepakSingh-n2g
@DeepakSingh-n2g Жыл бұрын
What’s the point of having private variable but both getter and setter be public?
@K4113B4113
@K4113B4113 4 жыл бұрын
You actually explained stuff as you did it. Amazing. My teacher can’t even do that. Subscribed.
@1sunflower2005
@1sunflower2005 4 жыл бұрын
@3:03 Name = name??? should it be name = Name?
@TurdFurgeson275
@TurdFurgeson275 4 жыл бұрын
Couldn’t have hurt you to watch 5 seconds more.
@user-uq1fq6gs3i
@user-uq1fq6gs3i 4 жыл бұрын
@@TurdFurgeson275 No he is actually correct
@SwinkMediaHouse
@SwinkMediaHouse 7 ай бұрын
Love the if-else outro... subbed!
@trymstmo5158
@trymstmo5158 3 жыл бұрын
Thank god, finally someone thats actullay are good at this. Thanks!
@hudsonsmith3
@hudsonsmith3 Жыл бұрын
I’m in ap csa, and for too long I have not understood this at all. Thank you so much!
@milankbudha
@milankbudha 4 жыл бұрын
good video..u were the 1st person to show the video in intellij ide....everyone does in eclipse
@bismahnawaz852
@bismahnawaz852 4 жыл бұрын
Hi at 5:00 you said that you could test it on the person class, how would you do that?
@ditavoncheese1680
@ditavoncheese1680 5 жыл бұрын
I didn't find the music distracting at all, it was quiet and peaceful. I was still able to focus on the tutorial.
@fkjgbrbr
@fkjgbrbr 6 жыл бұрын
3:05 may have them backwards. You would be changing the value of the parameter rather than the instance variable.
@crazyx3s
@crazyx3s 5 жыл бұрын
I think she meant that the parameter is set to the instance variable. It was just bad wording.
@bernardasigbe5847
@bernardasigbe5847 5 жыл бұрын
Yea. I was scrolling through the comments section to see if someone noticed that. Thanks @WeHungry. But in all, it's great explanation. Way to go Chandler!
@ahmedifhaam7266
@ahmedifhaam7266 2 жыл бұрын
yea its Kinda backwards. She explained how to use "this" keyword correctly, but after removing "this", she renamed the wrong variable.
@brijkumar8207
@brijkumar8207 3 жыл бұрын
Hello great explanation. Do you have Java class?
@olzhaskrm2628
@olzhaskrm2628 2 жыл бұрын
Hi CodingWithChandler, at 3:01 you said if we change name to Name it will be Name = name, however, if I understand correctly left side where is this.name related to private String name, and right side is what coming from method's parameter /argument. Please correct me if I'm wrong,
@afennelly99
@afennelly99 5 жыл бұрын
Why are there no setters and getters in the class for FavColor?
@Michelle-qw9qq
@Michelle-qw9qq 3 жыл бұрын
This is amazing! Thank you for breaking it all down I was definitely making things harder for myself lol.
@magoyama
@magoyama 4 жыл бұрын
that's a pity that the left border of the screen is slightly hidden, but your explanation is great, thank you!
@ZiadSpell
@ZiadSpell 3 жыл бұрын
Perfect explanation ✔️
@ADtranzakias
@ADtranzakias 4 жыл бұрын
Very simple and understandable. Thank you very much Chandler, see you in friends.
@DMV_Helal
@DMV_Helal 5 жыл бұрын
Thanks so clear to understand :)
@lestercarcamo4070
@lestercarcamo4070 2 жыл бұрын
Excellent. This is very good.
@melanie55555
@melanie55555 7 ай бұрын
LIFESAVER. THANK YOU!!!
@oki9Sedo1
@oki9Sedo1 3 жыл бұрын
Thank you for this! Very clear.
@merial8166
@merial8166 5 жыл бұрын
Very accurate and detailed explanation! Thank you!
@ramonsufranterecia7075
@ramonsufranterecia7075 Жыл бұрын
You are amazing, you just make it look so easy 🎉 thanks 🎉😅
@KY22077
@KY22077 Жыл бұрын
Thank you for such a good explanation. Please make videos about Design Patterns.
@lishebolishebo2801
@lishebolishebo2801 3 жыл бұрын
Well explained. Thank you.
@chaseblodgett5745
@chaseblodgett5745 3 жыл бұрын
Thank you!! Very well explained
@soulaimanov
@soulaimanov 5 жыл бұрын
What a beautiful explanation thank you for making things easy 🙏
@hewhomustnotbenamed3662
@hewhomustnotbenamed3662 3 жыл бұрын
Thank you so much! So understandable and clear!
@mrg3921
@mrg3921 4 жыл бұрын
Thanks a lot! Keep up the good work!
@RinorBislimi
@RinorBislimi 5 жыл бұрын
One of the best explained video :Y
@anodosarcade7355
@anodosarcade7355 5 жыл бұрын
3:26 so that variable is now that name for that variable to anything that references it, or just a instance of an object?
@edwamk
@edwamk 5 жыл бұрын
Amazing Demo
@angelryux
@angelryux 5 жыл бұрын
I finally get it now lol but I still not sure why we wouldn't just change the variables to whatever we want it to be instead of writing all that. Like just declare and assign them like: String Name = "Bob"; String Color = "Blue" ; int age = 16; And just call 'em?
@crazyx3s
@crazyx3s 5 жыл бұрын
I recommend you to watch 2 -3 videos on each topic you go over that way you can understand it in different angles This video explains it nicely: kzbin.info/www/bejne/hXeWp3WPjM6ej9U imagine you have thousands of methods and you need to change a value of a variable many months later but you forget the rules or conditions of a certain variable thats why through the setter you can change a value, with the condition, and through the getter you simply just return the value.
@kavin1814
@kavin1814 5 жыл бұрын
What if you wanna assign/change values & print the values of these variables from different class? Imagine that Scenario.
@ahmedifhaam7266
@ahmedifhaam7266 2 жыл бұрын
At around 3:17 I don't think your example of using 'this' keyword in java was entirely correct. Thought I'd point that out. Thanks
@mackymichel8052
@mackymichel8052 4 жыл бұрын
Thank for this lesson, but what if I wanted to include constructors( both of them), how would I define them?
@hossamqandel5303
@hossamqandel5303 3 жыл бұрын
Thank u Chandler ❤️🦅
@nitish2808
@nitish2808 3 жыл бұрын
How do I access a protected getter setter in another package in Java?
@petevegas3274
@petevegas3274 5 жыл бұрын
Great video and explanation!
@belgianheskey
@belgianheskey 2 жыл бұрын
So this is so the file(class) can access the variables from the other file?
@bobert471
@bobert471 3 жыл бұрын
So it's pretty much like creating helper functions similar to JavaScript and Node.js if I were building an API and had to get and set data. Really just helper functions right?
@Ozay1998
@Ozay1998 4 жыл бұрын
wow i finally understood it. thank you
@ThaThree
@ThaThree 5 жыл бұрын
Hi Chandler, everything works wonderfully except for the fact that I cannot input Bob's variables like you have, instead I have to put it in the brackets of "new Person(Insert variables here)". IntelliJ won't let me have it your way, why is that? I can see you're using the same IDE
@czciborczyz6192
@czciborczyz6192 6 жыл бұрын
Simple and Effective expleind , Thanks ;)
@betheBetterChoice
@betheBetterChoice 4 жыл бұрын
thanks well explained and nice voice too!!
@aferezek7781
@aferezek7781 5 жыл бұрын
so what is the difference between constructor and setters
@anodosarcade7355
@anodosarcade7355 5 жыл бұрын
I had trouble understanding what exactly TAKES IN variables in a paremeter, from inside the method or from the declared variables above. or from the other class that is using the getters and setters. I think im getting it now....
@jeremiedimarciello502
@jeremiedimarciello502 5 жыл бұрын
Does that info stay in the object? I could save the object close program..re open then getname and it still be bob?
@Matt-qr8yu
@Matt-qr8yu 3 жыл бұрын
you are a savior
@srinivasseenu1893
@srinivasseenu1893 3 жыл бұрын
can this be done in a single code
@SAM-ol5ip
@SAM-ol5ip 2 жыл бұрын
I hate how in uni they make this so hard while in reality it's not! thanks A LOT
@bluesp6267
@bluesp6267 4 жыл бұрын
Thank u. Really helpful
@sherylen.2169
@sherylen.2169 2 жыл бұрын
thankyou so much!😚
@alldayjose
@alldayjose 6 жыл бұрын
this was a bit helpful. thanks
@ayushlohariwal9904
@ayushlohariwal9904 5 жыл бұрын
I'm from India. Thank for making these videos. You helped me a lot. Love the way you describe coding. 😎 please make more videos on spring or hibernate.
@yasirzafar8075
@yasirzafar8075 4 жыл бұрын
Youre a life saver!
@aquate9637
@aquate9637 4 жыл бұрын
I don't get it, why not just make separate variables and then define them instead of just using setters and getters?
@davidhamilton9871
@davidhamilton9871 4 жыл бұрын
awesome thank you
@kay6730
@kay6730 2 жыл бұрын
did not see properties, only fields why ?
@4max0
@4max0 Жыл бұрын
Thank you so much. :)
@dronef0415
@dronef0415 3 жыл бұрын
This is basically string concatenation but with extra steps
@JP-programming
@JP-programming Жыл бұрын
Good job
@kidsin9
@kidsin9 5 жыл бұрын
Great thanks
@FireRust
@FireRust 5 жыл бұрын
i cant focus with the music... either talk louder or turn the music down please! :(
@cmh1198
@cmh1198 5 жыл бұрын
name of the song please?!
@fayoztoshmirzaev7895
@fayoztoshmirzaev7895 8 ай бұрын
Be honest who is BOB?! but actually thank you for the video
@xxmarksmanriflegodxx2071
@xxmarksmanriflegodxx2071 Жыл бұрын
3:03 this is not correct my guy, its has to be opposite if your paramter is Name and instance variable is name you would have to write name=Name;
@DhiaaAl-amdy
@DhiaaAl-amdy 3 ай бұрын
provocative AF
@anodosarcade7355
@anodosarcade7355 5 жыл бұрын
"intelliga can do that for you" interesting interesting....tell me more
@Jaylink15
@Jaylink15 5 жыл бұрын
IntelliJ
@pasindurangana643
@pasindurangana643 5 жыл бұрын
thank you
@dragutindjokovic
@dragutindjokovic 5 жыл бұрын
Great!
@peterkim9696
@peterkim9696 3 жыл бұрын
Nice.
@pleasures6909
@pleasures6909 4 жыл бұрын
Thanks. :)
@aubreyanderson4863
@aubreyanderson4863 5 жыл бұрын
cramming for a quiz wish me luck
@mukwevho01
@mukwevho01 3 жыл бұрын
i love that you are a female. finally. I've been getting only male tutors and its nice to get some feminine energy
@busarapumanikrishna4969
@busarapumanikrishna4969 4 жыл бұрын
Ur voice tone is quite different
@Morphues
@Morphues 4 жыл бұрын
thank u
@mariomartinez2939
@mariomartinez2939 5 жыл бұрын
Couldn't subscribe because the code you wrote asking to subscribe failed to compile. #braces
@seemarani-sk3et
@seemarani-sk3et 4 жыл бұрын
liked what you wrote at 8.21 but you forgot to close the else bracket , and hence lame one's will get error #lostYourSubscribers , lol
@kashif2309
@kashif2309 5 жыл бұрын
Thank you! no offense but why would someone put a piece of distracting music in an educational video.
Polymorphism in a Nutshell
5:44
CodingWithChandler
Рет қаралды 2,1 М.
Getters & Setters | Java | Tutorial 31
17:49
Giraffe Academy
Рет қаралды 112 М.
How to have fun with a child 🤣 Food wrap frame! #shorts
0:21
BadaBOOM!
Рет қаралды 17 МЛН
Wednesday VS Enid: Who is The Best Mommy? #shorts
0:14
Troom Oki Toki
Рет қаралды 50 МЛН
Vampire SUCKS Human Energy 🧛🏻‍♂️🪫 (ft. @StevenHe )
0:34
Alan Chikin Chow
Рет қаралды 138 МЛН
Getters and Setters Java Tutorial #84
14:12
Alex Lee
Рет қаралды 513 М.
Never Write a Getter or Setter in Java Again
10:41
Coding with John
Рет қаралды 155 М.
Java encapsulation 💊
8:27
Bro Code
Рет қаралды 130 М.
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 910 М.
Java toString method 🎉
6:39
Bro Code
Рет қаралды 107 М.
Java methods 📞
11:05
Bro Code
Рет қаралды 158 М.
Getters and Setters (Java OOP 2)
6:56
Caleb Curry
Рет қаралды 49 М.
Java access modifiers: (public, protected, private) 🔒
10:13
What is getter and setter method in Java | Core Java FAQs Videos | Naresh IT
5:32
How to have fun with a child 🤣 Food wrap frame! #shorts
0:21
BadaBOOM!
Рет қаралды 17 МЛН