This Keyword in Java Tutorial #80
Vložit
- čas přidán 27. 08. 2024
- $1,000 OFF ANY Springboard Tech Bootcamps with my code ALEXLEE. See if you qualify for the JOB GUARANTEE! 👉 bit.ly/3HX970h
This is the "this" keyword in java. It makes it easier to set variables in classes.
Learn java in just 13 minutes: • Learn Java in 14 Minut...
This in java is simply a keyword you use to set variables in classes.
The "this" keyword in java can be tricky at first... But SURELY you'll get it :) If you followed along, congrats! You learned by-doing!
I hope you enjoyed this "this" keyword in java video! I like to have a nice mix of java tutorials and actual projects for you all :)
Was this able to help you learn the this keyword in java? -
Full Java Tutorial For Beginners Playlist: • Full Java Course by Al...
Free Tips: bit.ly/3U6HXcb
Disclosure: The Springboard link provided is linked to my affiliate account & supports the channel.
~
Alex Lee
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
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?
it's a shame that you no longer make Java videos. You explain well and keep it simple. very helpful
explained a 1.5-hour lecture in 10.5 minutes. Amazing, thank you so much!
If your professor needed 90 minutes to improperly explain a basic concept.....I feel your pain.
I hate teachers who explained alot of useless things that took an hour to explain 10 minutes lesson
God is Good!
Matthew 7:7 :)
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.
For anyone who is coming from a Python background, “this” is the same thing as “self”
aye im coming from python background
Thanks now understand self
C++ here xD
i love you
Ah that makes sense
for me, a person is not good at English, you speak slowly so I can understand clearly. Thanks so much
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!
Great video!
You always do tutotials for EXACTLY what I need to know xD
Haha great :)
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!
This was the best explanation of the "this" keyword. I can't thank you enough...
Please make more videos ! Come back !! You are amazing !!
I need to say you are explain these things in your pretty easy way which is so helpful.
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 😅
Yes, I agree.
bro thank you so much! your vids are a big help Im so happy I can understand this now
These videos are so helpful,. Pages of complicated textbook chapters explained in 10 minutes. Thanks for doing them!
i was crying throughout my first year of college man if i knew this channel back then things would probably be easier for me
Thanks a lot Alex, for everyone the short-cut of System.out.println() is type sysout + hit buttons ctrl+space.
THIS actually makes so much sense lol thanks for simplifying
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!!
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 CZcams hate me. It unsubscribes me from loads of channels. Just realised it happened to this channel. There’s +1 sub for you
My guy, your videos are more coherent and comprehensible than my IFT210 prof. Keep up the good work, you are literally saving my grade.
Very clear explanation. 3 videos later, I've got it. Thanks man
Great explainer on why the THIS keyword is used in java
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.
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.
a lot of his videos are like this. They are sort of technically wrong. Which is misguiding people.
This really helps me alot more in my ON my online class...thanks for the help man!!
Good explanation. I was a bit confused when I first started learning about this, but it much clearer now. Thanks!
Awesome Video, helped a lot. You can also just Type syso and then hit the buttons
tysm 😭😭😭 i was so confused
Thank you so much I really needed that
Dude you vids are amazing
but in this particular video u shudnt have used the class name "Thisisfun"
Love from India❤️
Very helpful Alex
You're a legend. Thanks for this.
That was an amazing explanation! Thank you so much
I really need this omg thank you so much
Nice almost what I was looking for. The only thing that was missing is the useage of this on constructors not just variables
Or just ( String _food , char _size) {
}
so helpful, finally understand this this...
I love your video alex!! Very helpfull....keep going!!👍😊
Please cover oversize arrays! I love your channel
Thanks, you make the life so much easy, bless you
Thank you Alex, you made thing very clear. Liked and Subcribed
thank you man
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
Thank you Alex. you are the best 👌👌👌
6:00 or maybe simply name the parameters same as the attributes like a and b. But an underscore a_ b_.
or use this
thank you so much sir
I learn so much from your videos
Nicely done!
Instead of saying it could be "confusing", it's better to tell the viewers about scope of variables since that's the reason the variables "a" and "b" weren't changing
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.
thank you
why do we have to declaren the variables globaly? can't we just declare in the parameter list?
I can't help not looking at you when I'm listening to you
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!
So basically the “this” keyword doesn’t refer to the values in the parameter?
so the one without the this keywoard, will always refer to the variable given through the method ?
Thank you!!!
when we use this.a and this.b and remove static bcuse we can't do ith static variable t.a and t.b
Thank you for this video :)
why static cannot be used after the keyword this in this case?
Haha where was this when I was studying for a test I had today.
Btw any plans on doing videos about data structures?
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?
Thanks from Lithuania :)
thank you dude
thanks!
the classic "this means this" lol .. great tutorial makes me understand this Reference a lot more than just reading about it
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 😭
Absolutely amazing.
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?
Cool video, but what does it means when we call a method like this one: fun(this); what 'this' keyword means in this case?
What text editor is this?
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?
I'm a guy but 0:17 the look and tone blew me away!
why do we use eclipse to write Java on?
can anyone tell me why when i make a new class in netbeans it doesnt create my main method
thanks
Hey !! Alex loved your video .. but can you tell me the name of the song in the background @Alex Lee
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
So is it just like the __init__ method in python
great explanation, ta very much. can you tell me about a video to understand new keyword perfectly Sir!!?
i would recommend this video for my teacher
with arrays?
THIS!
i swear i would not pass my uni course if it wasn't for you alexxx leeeee
Curious, how did you make the instance of the class (object) without using a constructor in your code?
Still didn't understand
Rohit Raina 🤡
Class ref{
{
www.geeksforgeeks.org/this-reference-in-java/
}
Hope 'this' helps. Visit the link.
}
Can you please make a video on associations? It could save me!!!
am i the only one who heard him say at 6:30 if whether it's a big spoon or a large spoon? 💀💀 lmao
useful video though, thanks!
Couldn't you just have one variable be "setFood" and then have the setter statement say "food = setFood" to keep it clear?
I'm learning java at warp speed because of you.
Plz make a vid on creating our own packages and multiple class....
And can we do this package program on My phone
I feel like if it were callled 'that' it would make more sense
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)
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.
great video!
*_I read 'this keyboard'_*
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?
"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.
song that plays in the starting??
When would you then use this() - keyword?
In case you have multiple constructors, you can call a different constructor with this() keyword.
@@ariton2990 I appreciate your comment. Thank you
Hello Alex hope you are ok,
Thank you for the Java videos, I have learned a lot. I am trying to install eclipse but cant. The installation is very slow
and after a while it gives a message it did not install. I tried different connection, but nothing. Appreciate your support.