#51 This and Super Method in Java
HTML-код
- Опубликовано: 12 июл 2024
- Check out our courses:
Spring and Microservices Weekend Live Batch : bit.ly/spring-live-weekend
Coupon: TELUSKO10 (10% Discount)
Master Java Spring Development : bit.ly/java-spring-cloud
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 learn:
- Constructors in Java
- Super method in Java
- Object class in Java
- This method in Java
- Similarities in between this() and super() method
#1
- Whenever you call an object, it will create a constructor of a class.
- When we create an object of a class that it calls the constructor of a sub-class as well as a constructor of a superclass.
- If you do not pass any value in an object, then it will call the default constructor of a class.
- But if you pass the value in an object, then it will call the parameterised constructor of that class.
#2
Super() method:-
- Every constructor in Java has a method, even if you do not mention it.
- By default, the first statement in every constructor is a method called a super() method.
- Super() method means calls the constructor of a superclass.
- If you do not pass any parameter in a super method, then it will call the default constructor of a superclass.
- If you pass any parameter in a super method, then it will call the parameterised constructor of a superclass.
- To call the parameterised constructor of a parent class, we need to explicitly call the super method.
#3
Object class:-
- Every class in Java extends the Object class, even if you do not mention it.
- Object is a class in Java that contains a lot of methods.
- So, the super method of a superclass calls the constructor of an object class.
- There is multi-level inheritance in this concept.
#4
This() method:-
- this() method calls the constructor of the same class.
- If you do not pass any parameter in this method, then it will call the default constructor of the same class.
- If you pass any parameter in this method, then it will call the parameterised constructor of the same class.
#5
Similarities in between this() and super() method:-
- We can use both this and super method anywhere except the static area.
- Both this and super method can be used any number of times in a code.
But both can be used only one time inside a constructor.
- Both are non-static keywords.
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 Наука
That John Cena reference was on another level.there is no way i am going to forget super method after that 😁
You are the best Java teacher on RUclips. I subscribed to this channel and am learning one concept every day. You explain each concept in a very clear and concise but get to the point which helps me to learn quickly.
i have seen multiple videos for constructors and you always be my favorite. the kind of ease in your teaching is amazing and the humor that you add in between help us remember the key points. Thank you so much sir
Literally sir, so thankful to you ...what an amazing way to clear the depth topics....Hats off sir
This is the best explanation of so many scenarios with a crisp and clear explanation
You are an amazing teacher but pls reorder the playlist!
What a way to teach and share knowledge ....!
Very enlightening video, congrats!
This is very well detailed and easy to understand. Thank You!
Grateful to have found this channel, your way of explaining concepts is exactly what I've been looking for, keep up the good work Mr.Navin 👍
Thank you for introducing me to John Cena memes
9:04 best explanation
was waiting for this concept
QUALITY>>>QUANTITY
This is actually top-notch education, thank you for sharing so kindly your wisdom!
Thank you for the knowledge.
Very nice explanation sir
That's a deep explanation bro, thank you
Thank you for sharing..
Wow, terrific explanation!
You are awesome :) , I am learning from your channel
Hi thanks for sharing such an amazing knowledge. But you need to reorder it ..this video should be after inheritance video...
So plz reorder the playlist ...
excellent tutorial Sir.
efficiently taught
Thanks alot
Wow , amazing
It is indeed fun haha! great videos!
Now this was a good video, I liked it
thanks sir
Tq Sir Very Nice
thanks
With your video you clearly teach inheritance concepts and the way u add some fuuny joke reference like john cena you can't see me so good to remind the things.
dang I wish these videos were out when I was learning java for the first time.
Explanation ❤
the joke in the first sentence made me crack up, good work sir!
helpful :D
you're damn good
Where we create main method so it have class which we save as a class name, it's main class or not
11:58 , shouldn't super() for B be called twice?
Once by the this()->B()->super() and then by B(int)->super() (As every constructor have super() by default)?
Shouldn't the output be:
in A (from super of B(int) )
in A (from this() of B(int) to B() to super of B() )
in B ( (from this() of B(int) to B() )
in B int
very nice explanation Navin I really like your way of teaching and explanation... I have a small doubt, is it possible to execute only child constructor without parent constructer execution like I need a output of "in B"? if yes how?
Same question
Sir can you please provide the notes of this course?
can we parameterize the "This method" so that it accesses first the default B constructor followed by the int B and then default A
the output wile be like :
in A
in B int
in B
hey so does the objects constructor also call super() ?
hey!! sir your content is good but i persinally faced problem in the order of the videos. can you just reorder it again?
yeah me too
Sir, I have a doubt, is super only work on constructor ??
The John Cena metaphor... I'm studying for my final exam (tomorrow) and that John Cena metaphor just made me laugh in all these stress. Thanks Telusko!
John Cena ? 😂 You can't see it..damn this guy is so fun..!!! and the way he teaches with those expressions and thought processes of a student and then coming to the answer..is the best part of what he does.
guessing obvious wrong answers first like a student and then coming to the points and correct principles..
great, but what if i only want to call the constructor of class B is there a way to disable that super method, obviously not removing the extends A
Same doubt
❤❤❤❤
Sir I think there is a mistake in this . Super() doesn't behave as john cena in the constructor, it's there inside the class directly outside the constructor while extends any other class. @Telusko please confirm.
Your boring jokes are the best. 😂😂😂 Talking about John Cena memes 😂
sir ,the order of videos is misplaced
i love you.
is class B not extending object class along with Class A?
This () and Super() are being invoked in public B(int) to call all ? Doesn't work?
reorder the playlist
What should we see in this playlist before this video
@@heisenberg213 bro. this playlist is available as a 12hr long video. see the time stamps in that videos description
hahaha the John Cena meme, that was funny
i think inheritence is video number 48
How is the Class A getting called without creating an object of A ?
2nd comment
public class Main{
public static void main(String[] args) {
B obj = new B();//Object through constructor
obj.Announcement();//Method call
}
}
class A{//parent class
public A(){
//Constructor
}
public void Announcement(){
System.out.println("In A.");
}
}
class B extends A{//inheritance
public B(){
//Constructor
}
@Override //Changes method for B
public void Announcement(){
super.Announcement();//Call the parents method
System.out.println("In B.");//Overriden method
}
}
John Cena is there and can't see
May be its first comment
Jhon Cena ❤😂
are mughe chakkar aarhe hain
System.out.println("superbb teaching style! really interactive thankyou!");