#42 This keyword in Java

  Рет қаралды 118,405

Telusko

Telusko

Жыл бұрын

Check out our courses:
Enterprise Java Spring Microservices: go.telusko.com/enterpriseJava
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : bit.ly/java-spring-cloud
Coupon: TELUSKO20 (20% Discount)
Udemy Courses:
Java:- bit.ly/JavaUdemyTelusko
Spring:- bit.ly/SpringUdemyTelusko
Java For Programmers:- bit.ly/javaProgrammers
For More Queries WhatsApp or Call on : +919008963671
website : courses.telusko.com/
In this lecture we will see:
- Instance variable and Local variable
- Can we declare two or more variables with the same name?
- This keyword and its uses in Java
#1
Instance variable:- These variables are declared within a class but outside a method.
- These variables are created when we create an object and are destroyed when the object is destroyed.
Local variable:- These variables are declared within a method but do not get any default value.
- They are created when we enter a method or constructor and get destroyed when the call returns from the method.
#2
In Java, it is not allowed to declare two or more variables having the same name inside a scope either in class scope or method scope.
- The preference is always given to the local variable.
- Creating an object is not a good idea to solve the issue of conflicting names of instance and local variables.
- We can differentiate between local and instance variables by passing an object itself.
- Instead of writing and passing an object, we can simply use this keyword.
#3
This keyword:-
This keyword represents the current object.
- Current object is an object which is calling the method.
- This keyword is used to invoke the current class constructor.
- Using the 'this' keyword, we can return the current class instance.
- This keyword can be used as an argument in the constructor call.
Github repo : github.com/navinreddy20/Javac...
Java:- bit.ly/JavaUdemyTelusko
Spring:- bit.ly/SpringUdemyTelusko
More Learning :
Java :- bit.ly/3x6rr0N
Python :- bit.ly/3GRc7JX
Django :- bit.ly/3MmoJK6
JavaScript :- bit.ly/3tiAlHo
Node JS :- bit.ly/3GT4liq
Rest Api :-bit.ly/3MjhZwt
Servlet :- bit.ly/3Q7eA7k
Spring Framework :- bit.ly/3xi7buh
Design Patterns in Java :- bit.ly/3MocXiq
Docker :- bit.ly/3xjWzLA
Blockchain Tutorial :- bit.ly/3NSbOkc
Corda Tutorial:- bit.ly/3thbUKa
Hyperledger Fabric :- bit.ly/38RZCRB
NoSQL Tutorial :- bit.ly/3aJpRuc
Mysql Tutorial :- bit.ly/3thpr4L
Data Structures using Java :- bit.ly/3MuJa7S
Git Tutorial :- bit.ly/3NXyCPu
Donation:
PayPal Id : navinreddy20
www.telusko.com

Пікірлер: 50
@karthi7490
@karthi7490 2 ай бұрын
bro used entire 9 minutes just to define a single keyword , this shows he wants us to learn deeply 🙇🔥
@Viralvlogvideos
@Viralvlogvideos 11 ай бұрын
I was learning java for project requirement and this video saved my life to understand this in java it is weird but understood :) No one can escape this three languages in their life java, python and js
@sandybeast07_sb
@sandybeast07_sb 21 күн бұрын
Iam here from JS and i know the function of this keyword but when i was a beginner it was a huge headache for me. But after this video I can clearly state that Navin reddy sir aka telusko is one of the best teacher ever. Genius, the way he explained about this keyword..
@HishamMohammed-gh7eh
@HishamMohammed-gh7eh Жыл бұрын
Like me a person love details and how things works. I watched alot of tutorials about java and difficult topics like consturtor and this keyword,implicitly I understand it but I can't move without understanding initial way for things work. Your explaining with more fantastic details and different way, you are amazing . Thank you alot my teacher
@immadisettivarun
@immadisettivarun 11 ай бұрын
Amazing Explanation sir. Trying out different possibilities and explaining really nice
@Headcator
@Headcator Жыл бұрын
Your way of explaining things is fantastic. Thank you.
@Yashila_Jonnada
@Yashila_Jonnada Жыл бұрын
Best explanation ever! I can't thank you enough for these amazing tutorials sir.
@sahinsevinc41
@sahinsevinc41 7 ай бұрын
The best Java teacher I have ever seen. Explanations, Examples are perfect
@TreatsNTravelsByJaaiPawar
@TreatsNTravelsByJaaiPawar 11 ай бұрын
Grateful for this Playlist ...thank you!
@heytanibhi
@heytanibhi 10 ай бұрын
Thankyou sir ❤ keep teaching us like this. More respect to you sir.
@vishalrohera4328
@vishalrohera4328 2 ай бұрын
I watched many videos to understand how this keyword works, but none of them helped me. This video cleared all my doubts and questions. Thank you, sir, for this lecture!
@atulsolanki2519
@atulsolanki2519 Жыл бұрын
Excellent explanation ,thanks😊
@sathya8242
@sathya8242 Жыл бұрын
Thanks a ton sir, now the confusion got cleared for me for THIS keyword…. Your explanation is irreplaceable…🥰🥰🥰🥰🥰
@Luffy_2804
@Luffy_2804 Жыл бұрын
best explanation quality content fr🙂
@souvikkundu
@souvikkundu 8 ай бұрын
Perfectly explained. Thank you.
@vihangjoshi7525
@vihangjoshi7525 Жыл бұрын
Great way of explanation
@vicks3258
@vicks3258 Ай бұрын
Wow great concept Thanks you so much❤
@VarunGowda-ho2rm
@VarunGowda-ho2rm 2 ай бұрын
This video shows your passion towards teaching, great work sir, I'm impressed 👏🏼
@raghukumar8184
@raghukumar8184 Жыл бұрын
hi Navin , pls make a video on passing this keyword into methd arguements and passing this keyword as arguments in parameterised constructors
@CHALLENGESTORY
@CHALLENGESTORY 8 ай бұрын
bro why do you look so humble ❤️ thanks for the videos anna..!!
@sadhanarealty
@sadhanarealty 5 ай бұрын
Take simple example
@darswayeeyou
@darswayeeyou 11 ай бұрын
THIS is the only time I have ever understood the THIS keyword. Thank you so much!! So does that mean that the This keyword is only used in NON-STATIC methods?
@SumanMondal-gv8bi
@SumanMondal-gv8bi 3 ай бұрын
Thanks for the explaination Sir.
@abhiiiydv
@abhiiiydv Жыл бұрын
Hey Navin sir! Your fan from Nepal!
@Kaviarasu_NS
@Kaviarasu_NS 5 ай бұрын
I really helped me in understanding this, thanks ❤
@technocratsworld214
@technocratsworld214 3 ай бұрын
brilliant explanation
@sankarsubramanian6312
@sankarsubramanian6312 Жыл бұрын
Thanks Naveen 🔥 Big fan 💥
@sivadon4065
@sivadon4065 10 ай бұрын
Happy teacher's day sir🎉🎉🎉
@karthikplays69
@karthikplays69 4 ай бұрын
00:02 Understanding the 'this' keyword in Java 01:14 In Java, the stack memory and heap memory are used for different purposes. 02:27 Local and instance variables with the same name in Java 03:43 Assigning a variable to itself in Java can lead to unexpected behavior. 04:55 In Java, 'this' refers to the current object instance. 06:04 Creating a new object may cause issues with assigning values. 07:19 Passing object references and differentiating between instance and local variables in Java 08:36 The 'this' keyword represents the current object in Java
@faheelansari7353
@faheelansari7353 6 күн бұрын
Can we say that constructor return this that is why we can use to access instance variable Like Human obj = new Human(); //Human(); It is constructor call
@TECHWITHKAMALRAJ
@TECHWITHKAMALRAJ 8 күн бұрын
Java means Telusko ❤
@3lpme
@3lpme 8 күн бұрын
Can anyone one help me to understand ? I didn't understand at this "when we call age function we are passing the value ?👀 But why the heck we did we get zero, what's happening if we mention local and instance variable as same name ?
@nithintjoy6742
@nithintjoy6742 9 ай бұрын
one doubt, if we are not using this key word and just using two different variable names..will it work?
@karots77
@karots77 6 ай бұрын
yeah it will work
@Vinaygoud1264
@Vinaygoud1264 8 ай бұрын
Super sir
@syedadil7256
@syedadil7256 Жыл бұрын
Lil bit confusion sir.
@MahidharYouTube
@MahidharYouTube 28 күн бұрын
varayyo vammo...entha baga cheppav babai.
@jatinsharma3792
@jatinsharma3792 6 ай бұрын
What do you mean by the current object !?
@karots77
@karots77 6 ай бұрын
I think you are asking it for this keyword am I correct? if that is your question, Then whenever you create an object it cannot use the variable directly so we need to use methods to access it, when you create an object to modify those values using methods those object are the current object for the "this" keyword (this is not a correct answer this is what i understand so far)
@jatinsharma3792
@jatinsharma3792 6 ай бұрын
No, I sometimes didn't get what he meant, :D I understood about this keyword, I know It refer to the current class object, we use in many ways, for builder pattern and for constructor to set the values so we define it and distigawise between local and global var, I don't care much much he don't explain the internal thing, so for refresh it is fine but not for the real knowledge. @@karots77
@0shaad
@0shaad Жыл бұрын
we cant call local variable outside of its local context
@pradeepdeeps2832
@pradeepdeeps2832 7 ай бұрын
That's a lot of THIS😂
@ShubhamVerma-nu3ze
@ShubhamVerma-nu3ze 9 ай бұрын
great teacher love you
@CHALLENGESTORY
@CHALLENGESTORY 8 ай бұрын
line 30 obj.setAge(age: 30); // how did he type this inside the bracket--> age:
@Telusko
@Telusko 8 ай бұрын
Inlay hints added by vs code (not a part of the code) Not written by me.
@CHALLENGESTORY
@CHALLENGESTORY 8 ай бұрын
@@Telusko oh, I'm learning java using Eclipse which is why I was unaware..thanks bro..
@someshwarreddy8463
@someshwarreddy8463 28 күн бұрын
@sarthak-salunke
@sarthak-salunke 7 ай бұрын
🙏❣
@rounaksingh3255
@rounaksingh3255 Жыл бұрын
sir khud he kyu padh rahe ho
#43 Constructor in Java
7:05
Telusko
Рет қаралды 143 М.
#51 This and Super Method in Java
12:11
Telusko
Рет қаралды 95 М.
Sigma Kid Hair #funny #sigma #comedy
00:33
CRAZY GREAPA
Рет қаралды 37 МЛН
Spot The Fake Animal For $10,000
00:40
MrBeast
Рет қаралды 176 МЛН
ВОДА В СОЛО
00:20
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 30 МЛН
#40 Encapsulation in Java
11:42
Telusko
Рет қаралды 154 М.
USAGE OF THIS KEYWORD - JAVA PROGRAMMING
11:12
Sundeep Saradhi Kanthety
Рет қаралды 102 М.
This Keyword in Java Full Tutorial - How to Use "this"
7:39
Coding with John
Рет қаралды 141 М.
P19 - This keyword in Java | Core Java |
12:56
H Y R Tutorials
Рет қаралды 15 М.
Generics in Java
14:26
Telusko
Рет қаралды 504 М.
Functional Interface | Lambda Expression in Java
13:56
Telusko
Рет қаралды 142 М.
#26 Stack And Heap in Java
12:37
Telusko
Рет қаралды 218 М.
Super Keyword in Java Full Tutorial - How to Use "super"
11:33
Coding with John
Рет қаралды 199 М.
This Keyword in Java Tutorial #80
10:39
Alex Lee
Рет қаралды 181 М.
Опасность фирменной зарядки Apple
0:57
SuperCrastan
Рет қаралды 10 МЛН
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 468 М.
Запрещенный Гаджет для Авто с aliexpress 2
0:50
Тимур Сидельников
Рет қаралды 753 М.