This Keyword in Java Tutorial #80

  Рет қаралды 186,178

Alex Lee

Alex Lee

Күн бұрын

Пікірлер: 191
@alexlorenlee
@alexlorenlee Жыл бұрын
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
@sammamrariana5880
@sammamrariana5880 10 күн бұрын
is it still valid
@iwatchedthevideo7115
@iwatchedthevideo7115 5 жыл бұрын
I just went to bed, after watching the lecture video of my babbling uni professor confusing the hell out of us about the this keyword and blasting through 200 incoherent slides. Then this comes up in my recommended! This is so much clearer and I actually understand it now! Thanks! I think Ill just skip my school lectures now and just watch your videoes. Are you planning on doing anything about polymophism and unit testing?
@tbinyt
@tbinyt 2 жыл бұрын
it's a shame that you no longer make Java videos. You explain well and keep it simple. very helpful
@asmaabdullah9068
@asmaabdullah9068 4 жыл бұрын
explained a 1.5-hour lecture in 10.5 minutes. Amazing, thank you so much!
@maxassasin911
@maxassasin911 4 жыл бұрын
If your professor needed 90 minutes to improperly explain a basic concept.....I feel your pain.
@endone3661
@endone3661 4 жыл бұрын
I hate teachers who explained alot of useless things that took an hour to explain 10 minutes lesson
@mikebrown5142
@mikebrown5142 Жыл бұрын
God is Good! Matthew 7:7 :)
@lutz
@lutz 5 жыл бұрын
Dude, I've been trying to get into Java for a long time and made amazing progress with some friend's help but geez, this videos are hella helpful.
@luka-j-ovanovic
@luka-j-ovanovic 4 жыл бұрын
For anyone who is coming from a Python background, “this” is the same thing as “self”
@ejm209
@ejm209 4 жыл бұрын
aye im coming from python background
@glitchlover260
@glitchlover260 4 жыл бұрын
Thanks now understand self
@animehub38n2
@animehub38n2 4 жыл бұрын
C++ here xD
@crazykalo4301
@crazykalo4301 4 жыл бұрын
i love you
@coolfred9083
@coolfred9083 4 жыл бұрын
Ah that makes sense
@dylanchan3772
@dylanchan3772 4 жыл бұрын
Thank you so much Alex!!!! i've been taking a java course at a community college over the summer as a high school student and I've struggled so much with the quick pace and loads of reading. But your videos have saved me!!!! Instead of reading for hours and comprehending 5% of it, I can watch a video like this one and instantly understand it!! This is so much better than the textbook!
@hien6451
@hien6451 3 жыл бұрын
for me, a person is not good at English, you speak slowly so I can understand clearly. Thanks so much
@jacquelinezapatasaavedra1516
@jacquelinezapatasaavedra1516 Жыл бұрын
Please make more videos ! Come back !! You are amazing !!
@amankaushik5833
@amankaushik5833 4 жыл бұрын
This was the best explanation of the "this" keyword. I can't thank you enough...
@academicresourcesaccountfo9176
@academicresourcesaccountfo9176 3 жыл бұрын
Alex, you are a gem for us beginners! You just put this out in such ways that are easy for us to digest! Thank you so much, man! God bless you!
@עדןמזור
@עדןמזור 5 жыл бұрын
Great video! You always do tutotials for EXACTLY what I need to know xD
@alexlorenlee
@alexlorenlee 5 жыл бұрын
Haha great :)
@sayangku9275
@sayangku9275 4 жыл бұрын
i was crying throughout my first year of college man if i knew this channel back then things would probably be easier for me
@simon_gergely
@simon_gergely 2 жыл бұрын
These videos are so helpful,. Pages of complicated textbook chapters explained in 10 minutes. Thanks for doing them!
@nicktendocreep
@nicktendocreep Жыл бұрын
bro thank you so much! your vids are a big help Im so happy I can understand this now
@sree4528
@sree4528 4 жыл бұрын
I need to say you are explain these things in your pretty easy way which is so helpful.
@miguelluizherrera4529
@miguelluizherrera4529 3 жыл бұрын
I watched my prof cram the discussion of this, static, and methods, and classes in one single lecture and honestly felt like crying. Thank you so much for sharing this!!
@rayenabadlia5766
@rayenabadlia5766 5 жыл бұрын
We need a tutorial about " super " key word which is used in inheritance plz 🙏 this was so helpful i clicked the thumbs up button before even watching 😅
@Christfemme
@Christfemme 4 жыл бұрын
Yes, I agree.
@abdeselamselami4532
@abdeselamselami4532 5 жыл бұрын
Thanks a lot Alex, for everyone the short-cut of System.out.println() is type sysout + hit buttons ctrl+space.
@josephnagy2566
@josephnagy2566 3 жыл бұрын
My guy, your videos are more coherent and comprehensible than my IFT210 prof. Keep up the good work, you are literally saving my grade.
@benvoisey3942
@benvoisey3942 5 жыл бұрын
Oh my god. I’m not gonna get into details but you are literally so much help. I started my GCSEs this year, and you are the reason I took computer science. Thank you so much for the inspiration. Still watching after >1 year. ❤️❤️❤️ Edit: Oh my god why does KZbin hate me. It unsubscribes me from loads of channels. Just realised it happened to this channel. There’s +1 sub for you
@melvingx
@melvingx 5 ай бұрын
THIS actually makes so much sense lol thanks for simplifying
@ThatguyWitjokes
@ThatguyWitjokes 4 жыл бұрын
Very clear explanation. 3 videos later, I've got it. Thanks man
@milehighgarage
@milehighgarage 2 жыл бұрын
Great explainer on why the THIS keyword is used in java
@jessicabautista8687
@jessicabautista8687 3 жыл бұрын
I really need this omg thank you so much
@zj10
@zj10 3 жыл бұрын
Good explanation. I was a bit confused when I first started learning about this, but it much clearer now. Thanks!
@kvndotcode
@kvndotcode 4 жыл бұрын
This really helps me alot more in my ON my online class...thanks for the help man!!
@selvamariairudayam5197
@selvamariairudayam5197 3 жыл бұрын
Very helpful Alex
@mrg3921
@mrg3921 3 жыл бұрын
Nicely done!
@hamsal_khaldi7851
@hamsal_khaldi7851 3 жыл бұрын
Thanks, you make the life so much easy, bless you
@suryamgupta4467
@suryamgupta4467 4 жыл бұрын
That was an amazing explanation! Thank you so much
@Snipesaintme
@Snipesaintme Жыл бұрын
Thank you so much I really needed that
@dname1802
@dname1802 5 ай бұрын
Thank you so much, you're the best!!!
@youareiamurim
@youareiamurim 5 жыл бұрын
I love your video alex!! Very helpfull....keep going!!👍😊
@marclesterdelapena8309
@marclesterdelapena8309 4 жыл бұрын
You're a legend. Thanks for this.
@russellandrady
@russellandrady 2 жыл бұрын
Absolutely amazing.
@AkashdeepSingh-qq5fw
@AkashdeepSingh-qq5fw 3 жыл бұрын
6:00 or maybe simply name the parameters same as the attributes like a and b. But an underscore a_ b_.
@Death2AllGaming
@Death2AllGaming 3 жыл бұрын
or use this
@ogmine9913
@ogmine9913 3 жыл бұрын
tysm 😭😭😭 i was so confused
@MinhTran-sl7kc
@MinhTran-sl7kc 3 жыл бұрын
Thank you Alex, you made thing very clear. Liked and Subcribed
@justkleedesigns
@justkleedesigns 5 жыл бұрын
Awesome Video, helped a lot. You can also just Type syso and then hit the buttons
@user-qo3ih7vj4n
@user-qo3ih7vj4n 3 жыл бұрын
I learn so much from your videos
@YW-zm3ds
@YW-zm3ds 4 жыл бұрын
so helpful, finally understand this this...
@nadi6044
@nadi6044 5 жыл бұрын
Thank you Alex. you are the best 👌👌👌
@a99g
@a99g 9 ай бұрын
What text editor is this?
@ibrahimylmaz8378
@ibrahimylmaz8378 2 жыл бұрын
thank you man
@jyrikgauldurson8169
@jyrikgauldurson8169 5 жыл бұрын
The 'this' keyword is not there so that you can name local variables the same as class members. It is a reference to the instance of a given constructed object. The naming issue occurs because 'a' and 'b' are shadowed by the parameter names. I suggest that viewers take a deeper look into this for a better fundamental understanding of OOP and the 'this' keyword.
@edgarwideman737
@edgarwideman737 4 жыл бұрын
Your correct, but these tutorials are for beginners! Unlike useless college professors, this guy explains java in simple language so you can get started, only then is it possible to go in-depth. Almost 50% of students learn more from youtube when getting started in computer science, then from there $$$ school lessons. That's why I skipped college and University altogether and am now a successful android developer.
@tawsifiqbalshurid5773
@tawsifiqbalshurid5773 2 жыл бұрын
a lot of his videos are like this. They are sort of technically wrong. Which is misguiding people.
@robert4598
@robert4598 3 жыл бұрын
5:25 This was not very well explained. Why doesn't it work? We tell the program to put our input a value in t.a and it doesn't do it? Shouldn't it be the same, just so that we put it in a specific object?
@Applestaffman
@Applestaffman 2 жыл бұрын
why static cannot be used after the keyword this in this case?
@tahabekmez5072
@tahabekmez5072 5 жыл бұрын
I'm a guy but 0:17 the look and tone blew me away!
@Larichanns
@Larichanns 5 жыл бұрын
Please cover oversize arrays! I love your channel
@jatindhiman2261
@jatindhiman2261 3 жыл бұрын
thank you so much sir
@46Bax
@46Bax 3 жыл бұрын
so the one without the this keywoard, will always refer to the variable given through the method ?
@Matt-nx6uu
@Matt-nx6uu 3 жыл бұрын
I'm beginner-intermediate, ya know, acing my exams basically. No clue what this is used for yet, so cheers if this helps me figure it out lol
@nawfalnjm5699
@nawfalnjm5699 3 жыл бұрын
thank you
@justinsanesc.9085
@justinsanesc.9085 3 жыл бұрын
Thank you for this video :)
@maryyamsiddiqa3859
@maryyamsiddiqa3859 3 жыл бұрын
why do we have to declaren the variables globaly? can't we just declare in the parameter list?
@arischvaranpuvanesvaran8875
@arischvaranpuvanesvaran8875 3 жыл бұрын
Thank you!!!
@MrLithuanian91
@MrLithuanian91 4 жыл бұрын
Thanks from Lithuania :)
@only_fair23
@only_fair23 2 жыл бұрын
Can someone explain why the static won't work with this? Or in what situations static doesn't work? I understand where to use it but don't know why it doesn't work in more situations.
@jake_3745
@jake_3745 4 жыл бұрын
Nice almost what I was looking for. The only thing that was missing is the useage of this on constructors not just variables
@joycelillian1815
@joycelillian1815 4 жыл бұрын
I can't help not looking at you when I'm listening to you
@sabertoothwallaby2937
@sabertoothwallaby2937 3 жыл бұрын
why do we use eclipse to write Java on?
@scottw7895
@scottw7895 5 жыл бұрын
What are the benefits and downsides to this method vs using static variables? You wouldn't have to pass static variables, which is considered best practice?
@londiniburro1931
@londiniburro1931 4 жыл бұрын
thank you dude
@sarthakjoshi21
@sarthakjoshi21 2 жыл бұрын
when we use this.a and this.b and remove static bcuse we can't do ith static variable t.a and t.b
@onpointinsight
@onpointinsight 3 жыл бұрын
am i the only one who heard him say at 6:30 if whether it's a big spoon or a large spoon? 💀💀 lmao
@onpointinsight
@onpointinsight 3 жыл бұрын
useful video though, thanks!
@jonahosband4534
@jonahosband4534 3 жыл бұрын
Could someone explain why the compiler is confused when in the method he created a new instance of the object then used t.a and t.b? I understand most of this vid but that example is strange because I would assume that the values would be assigned correctly since you are using the instance and dot operator
@liyasamuel4133
@liyasamuel4133 4 жыл бұрын
i swear i would not pass my uni course if it wasn't for you alexxx leeeee
@megasmit
@megasmit 3 жыл бұрын
can anyone tell me why when i make a new class in netbeans it doesnt create my main method thanks
@seenathgooding181
@seenathgooding181 2 жыл бұрын
thanks!
@ahmadmousa6895
@ahmadmousa6895 3 жыл бұрын
i would recommend this video for my teacher
@aadityagadhvi4236
@aadityagadhvi4236 4 жыл бұрын
So is it just like the __init__ method in python
@adityakadam830
@adityakadam830 3 жыл бұрын
Dude you vids are amazing but in this particular video u shudnt have used the class name "Thisisfun" Love from India❤️
@counterpointerz-rocketleag2038
@counterpointerz-rocketleag2038 4 жыл бұрын
Or just ( String _food , char _size) { }
@gaycat599
@gaycat599 4 жыл бұрын
great video!
@Sk8erMorris
@Sk8erMorris 5 жыл бұрын
the classic "this means this" lol .. great tutorial makes me understand this Reference a lot more than just reading about it
@caseyj9
@caseyj9 4 жыл бұрын
So the bottom soup in the allocation moves first into the Set data and then that puts it also into the Class as a whole? (Arrows would help in the future). Also, is the purpose so that the rest of the class methods have access to the food and size data? (I’m so New I’ve just been writing print within the method taking the parameters so that I can just reuse the names there without issue. Or sending them into another print method directly)
@mouminali1380
@mouminali1380 5 жыл бұрын
Haha where was this when I was studying for a test I had today. Btw any plans on doing videos about data structures?
@Khyrid
@Khyrid 3 жыл бұрын
I'm learning java at warp speed because of you.
@karammohmmad5065
@karammohmmad5065 2 жыл бұрын
with arrays?
@dickhea334342545
@dickhea334342545 2 жыл бұрын
Curious, how did you make the instance of the class (object) without using a constructor in your code?
@SnS-SpartaN
@SnS-SpartaN Жыл бұрын
*_I read 'this keyboard'_*
@notyournormaldev1419
@notyournormaldev1419 4 жыл бұрын
Hey !! Alex loved your video .. but can you tell me the name of the song in the background @Alex Lee
@herobrinehacks2321
@herobrinehacks2321 3 жыл бұрын
Cool video, but what does it means when we call a method like this one: fun(this); what 'this' keyword means in this case?
@rohitasoni4906
@rohitasoni4906 4 жыл бұрын
song that plays in the starting??
@biracialballoon524
@biracialballoon524 4 жыл бұрын
When would you then use this() - keyword?
@ariton2990
@ariton2990 4 жыл бұрын
In case you have multiple constructors, you can call a different constructor with this() keyword.
@biracialballoon524
@biracialballoon524 4 жыл бұрын
@@ariton2990 I appreciate your comment. Thank you
@jonsdogg2400
@jonsdogg2400 4 жыл бұрын
You never know how many tries and attempts I did to phrase this out for KZbin to understand that I'm referring to this.keyword in coding
@gericofrancisco2013
@gericofrancisco2013 5 жыл бұрын
So you just use the "this" keyword whenever you are using a globally declared variable or to lessen the use of objects inside your methods. Thanks for another good upload brother! Keep it up!
@hayyanmezher4236
@hayyanmezher4236 4 жыл бұрын
I tried to do what you did without instances because I felt that they are somehow redundant steps. and indeed Java asked for them. what is the reason? I think simply (in theory) we gave our parameters the right type of variable. isn't that enough?
@ariton2990
@ariton2990 4 жыл бұрын
"this" keyword refers to THIS instance, so you cant really use "this" keyword without using instances. When you do "this.a", you are refering to the variable "a" of this instance.
@michaelcoleman3407
@michaelcoleman3407 2 жыл бұрын
So basically the “this” keyword doesn’t refer to the values in the parameter?
@benjamincox9762
@benjamincox9762 5 жыл бұрын
How do you set your settings so that when you create a new java project, it automatically goes into your package explorer? I have to extract my java projects manually and it would be just so much easier and less time consuming if I didn’t have to do that anymore.
@christianwtf2960
@christianwtf2960 4 жыл бұрын
So do you put the variables up at the top under class so that it's able to be used at any point in the code? So that you don't need to reassign it for every method?
@ariton2990
@ariton2990 4 жыл бұрын
yes. variables outside of any method declaration are global.
@christianwtf2960
@christianwtf2960 4 жыл бұрын
Ariton Thanks for the reply! Can you make scanners global so you don’t have to send it to each method?
@ariton2990
@ariton2990 4 жыл бұрын
@@christianwtf2960 yes
@christianwtf2960
@christianwtf2960 4 жыл бұрын
@@ariton2990 Is there a downside to doing that? Because it sounds like its better than creating it in the main and sending it to other methods.
@ariton2990
@ariton2990 4 жыл бұрын
@@christianwtf2960 Cant think of any downsides. The only notable downside I can think of is that every method can have access to the scanner, even if you dont want to.
@pbetftdi
@pbetftdi 2 жыл бұрын
Still quite confused. Why even name variables the same name and go through all the confusion of this (other than it will be a few questions on the certification exam) when its so much easier, clearer, and not frustratingly confusing to name the variable different names?
@lukemalonis8533
@lukemalonis8533 4 жыл бұрын
Dayummmm I understood this so fast. You are somehow better than all of the Indian guys on here 😂.
@paulburger330
@paulburger330 4 жыл бұрын
8:30 where the penny dropped for me (Edited) great tutorial btw
@victorpinasarnault9135
@victorpinasarnault9135 2 жыл бұрын
Liked and subscribed.
@mzamomahaeng268
@mzamomahaeng268 3 жыл бұрын
this was a great video 👍 see what I did there.Thank you man
@4ashutosh
@4ashutosh 4 жыл бұрын
Thanks but I have a question, why we cannot use "this" in a static method?
@ariton2990
@ariton2990 4 жыл бұрын
Because static methods belong to the class and not to any instances.
@coleeckerman1390
@coleeckerman1390 4 жыл бұрын
THIS!
@sitinorfarhana5510
@sitinorfarhana5510 3 жыл бұрын
My lecturer just gave me the code and I need to copy paste it into java and see it for myself what it had done TT and tomorrow i have TESTTTTTTT 😭
Inner Class Java Tutorial #81
4:30
Alex Lee
Рет қаралды 51 М.
Java Super Keyword Tutorial #87
15:00
Alex Lee
Рет қаралды 232 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
This Keyword in Java Full Tutorial - How to Use "this"
7:39
Coding with John
Рет қаралды 163 М.
HashMap Java Tutorial #50
11:42
Alex Lee
Рет қаралды 415 М.
#42 This keyword in Java
9:45
Telusko
Рет қаралды 178 М.
Encapsulation in Java Tutorial #83
11:06
Alex Lee
Рет қаралды 265 М.
Super Keyword in Java Full Tutorial - How to Use "super"
11:33
Coding with John
Рет қаралды 225 М.
How to Code (almost) Any Feature
9:48
DaFluffyPotato
Рет қаралды 715 М.
Object-Oriented Programming Java Tutorial (Java OOP) #71
14:07
Getters and Setters Java Tutorial #84
14:12
Alex Lee
Рет қаралды 514 М.
Return Statement in Java #27
14:38
Alex Lee
Рет қаралды 285 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН