No video

#6.2 Java Tutorial | Super Method

  Рет қаралды 164,173

Telusko

Telusko

Күн бұрын

Whenever you create the object of subclass, then it calls the constructor of subclass as well as of parent class.
-When we object of subclass by specifying the parameter, it will call specified constructor of subclass but it will call the default constructor of superclass.
Why the object of subclass always call the default constructor of super class?
- Every constructor in subclass will have a by default method called as "super".
- Super method is by default given by the compiler even if you do not mention it.
Super keyword:-
- The super keyword in Java is a reference variable that is used to refer parent class objects.
- super can be used to call parent class’ variables and methods.
Super method:-
- The super keyword can also be used to access the parent class constructor by adding ‘()’ after it like super().
- Super() method will directly call the constructor of superclass.
- By default, complier puts the super method without parameters.
- If you will pass parameters to super method, then it will call the parameterized constructor of the super class.
- ‘super()’ can call both parametric as well as non-parametric constructors depending upon the situation.
In this video we will see:
- How to call constructors of both subclass and superclass?
- Why object of subclass always call the default constructor of super class?
- Super keyword
- Super() method
Instagram : / navinreddyofficial
Linkedin : / navinreddy20
Discord : / discord
More Learning :
Java - bit.ly/3xleOA2
Python :- bit.ly/3H0DYHx
Django :- bit.ly/3awMaD8
Spring Boot :- bit.ly/3aucCgB
Spring Framework :- bit.ly/3GRfxwe
Servlet & JSP :- bit.ly/3mh5CGz
Hibernate Tutorial :- bit.ly/3NWAKah
Rest API | Web Service Tutorial :- bit.ly/38RJCiy
Git :- bit.ly/3NUHB3V
JavaScript :- bit.ly/3mkcFys
Kotlin :- bit.ly/3GR2DOG
Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
www.telusko.com...

Пікірлер: 108
@jassi9022
@jassi9022 4 жыл бұрын
I rarely find anyone on YT who teaches as clearly as you.
@anushreevirtualgaming226
@anushreevirtualgaming226 2 жыл бұрын
i have found none more simplier in such less time, apna college is faster with less clarity , code with harry has clarity but takes more time , and other course also takes pretty much time , but this man is a wonder
@abhishekraj9077
@abhishekraj9077 4 жыл бұрын
Best Teacher that i ever got in my life is only you ... You are amazing Sir.
@mainulhasan136
@mainulhasan136 4 жыл бұрын
Don't judge a book by its cover.......Learners faith in him . His explanation is dam good.You are absolutely amazing. ...You are one of the good teacher i have ever seen.
@ghaith99000
@ghaith99000 4 жыл бұрын
I have tried to understand inheritance but I couldn't understand it. You are the only one who I could understand .Thanks my teacher
@H-CSELEKrishnaMohan
@H-CSELEKrishnaMohan 3 жыл бұрын
Man you're teaching so well You earn a sub , and you earn my respect
@SgtMajorJay
@SgtMajorJay 5 жыл бұрын
Finally!! Kept watching videos and it wasn't clear until now!
@maronnambo7918
@maronnambo7918 4 жыл бұрын
You are a good teacher; I am impressed.
@sraynitjsr
@sraynitjsr 6 жыл бұрын
Sir, please say "welcome back alians"
@chinmaydas4053
@chinmaydas4053 6 жыл бұрын
😂😂..
@RGMUTEX
@RGMUTEX 9 ай бұрын
The way you teach is really incridible❤
@sanketpadgelwar25
@sanketpadgelwar25 3 жыл бұрын
After watching only one vdo became fan sir....❤️
@devmankad3992
@devmankad3992 4 жыл бұрын
You make my lockdown study better 😊
@amanvijayvargiya3468
@amanvijayvargiya3468 3 жыл бұрын
In 2021,still this is the best video on super in java
@ARAVINIDHS
@ARAVINIDHS 3 жыл бұрын
Still today your video is very useful. I watch your videos from 2020
@rashmiambedkar5143
@rashmiambedkar5143 6 жыл бұрын
finally i understood the need of inheritance. thx Navin
@nurdandamlalar7808
@nurdandamlalar7808 3 жыл бұрын
The best and short video about super keyword. you are awesome.
@ruhnshnik9106
@ruhnshnik9106 4 жыл бұрын
Flawlessly explained.. really so good keep it up please..no lecture just an example and boom tres bien!!
@rekhanatarajan6149
@rekhanatarajan6149 3 жыл бұрын
thank u so much for the clear explanation sir....
@dishagshetty8983
@dishagshetty8983 4 ай бұрын
Simple and precise. Thank you sir.
@manveersingh5822
@manveersingh5822 6 жыл бұрын
The video is also super....
@user-ne6iy4xz1u
@user-ne6iy4xz1u 4 жыл бұрын
may you live 1000 years and thanks for everything
@manpinder28
@manpinder28 4 жыл бұрын
Simple & clear. Thank you for explaining.
@ravijatwa240
@ravijatwa240 3 жыл бұрын
You are awesome sir. And we are aliens 😂😂
@DipakDas-mf3jf
@DipakDas-mf3jf 11 ай бұрын
Thank you for very easy Explanation..
@NhuNguyen-gl3dv
@NhuNguyen-gl3dv 3 жыл бұрын
I learnt a lot from your videos. Thanks a lot.
@tannerbarcelos6880
@tannerbarcelos6880 4 жыл бұрын
Java is just so much cleaner than c++
@vikneshnt1843
@vikneshnt1843 3 жыл бұрын
You the best, love you man❤️
@Code_JAVA268
@Code_JAVA268 Ай бұрын
Best Teacher
@kajal12_20
@kajal12_20 2 жыл бұрын
No doubt .. best explanation.thankyou so much sir.
@joebertdorias1391
@joebertdorias1391 6 жыл бұрын
Now I understand the used of super
@arjundhatbale4412
@arjundhatbale4412 2 жыл бұрын
Thank You very much sir for this video.
@ayusharora2019
@ayusharora2019 6 жыл бұрын
please create a public gist file for your code. I am creating notes from your code and would need the code from a lot of your videos. Btw the video was simple and to the point. Good work pal !!
@sadikursiam-2067
@sadikursiam-2067 2 жыл бұрын
Thanks man ! It was really helpful !!!!!!
@suryayadav4335
@suryayadav4335 2 жыл бұрын
very nice explaination
@JimVincitore
@JimVincitore 4 жыл бұрын
Great video! Very cool! Thank you!
@anishrobert5056
@anishrobert5056 4 жыл бұрын
Great explanation........ Thank you sir
@c00per_
@c00per_ 2 жыл бұрын
Thank you sir. The most easily understandable 😭🙌🏼
@dylanwatts2773
@dylanwatts2773 5 жыл бұрын
thank you for this video it really helped a lot:)
@ShubhamTiwari-bd5xg
@ShubhamTiwari-bd5xg 3 жыл бұрын
I dont think anyone could better teach than you sir
@alexschmidt4371
@alexschmidt4371 5 жыл бұрын
So in case anyone still confused, the super() method calls the constructor of its super-class. As simple as it says and you only can use super() inside the sub-class's constructor. And I don't know why, but the super() method should be the first statement in the constructor of the sub-class.
@f3rdi881
@f3rdi881 4 жыл бұрын
It should be first because you want the code to initiate from the parent down. Because the parent can affect the child but the child can't affect the parent. So it calls the parent then that parent might be a child to another parent so it calls that parent and so on.
@f3rdi881
@f3rdi881 4 жыл бұрын
Also really if your using a non-parameterized super() constructor then your better off just leaving it blank. It unnecessary code..
@alexschmidt4371
@alexschmidt4371 4 жыл бұрын
@@f3rdi881 wow ty
@micky992
@micky992 6 жыл бұрын
Perfect Explanation and very easy to understand.
@nehakumari-fv8fh
@nehakumari-fv8fh 6 жыл бұрын
Hi Naveen Doubt: In class B super() method is there by default (not declared in it since it is by default) + I added super (int i) with parameter.Then it should call both methods of Super class (constructor and Constructor with parameter) right?. If I am not right please let me know the concept please....
@arunavamodak2385
@arunavamodak2385 5 жыл бұрын
Not really if u called super(int i) it calls only the parameterized constructor of the parent class... If no super was added.. then it wud have called nly the default one
@mansurishamim5666
@mansurishamim5666 11 ай бұрын
No if you are specifying the super() method with parameters then it will only call the parameterized constructor of class but not the default constructor of class.
@rajadapa3111
@rajadapa3111 3 жыл бұрын
Before seeing this video I know the subject After seeing this video I'm FULL confident in SUBJECT thanks a lot sir Really amazing explanation ❤
@mooht3203
@mooht3203 4 жыл бұрын
Really Telusko thank you for this crutial information , you are all the time helping me out :')
@sreeshakv5405
@sreeshakv5405 Жыл бұрын
Great explanation.. Thanks sir
@rovsenhuseynov8368
@rovsenhuseynov8368 4 жыл бұрын
very useful lesson. Thanks. Telusko!
@diegodebunks8459
@diegodebunks8459 4 жыл бұрын
Good explanation!
@harikrishnayadav984
@harikrishnayadav984 2 жыл бұрын
Great explanation sir...
@dhanalekshmi4097
@dhanalekshmi4097 6 жыл бұрын
Really ur Amazing..its very interested to hear..what ur coming to say..good work..
@gladys.n317
@gladys.n317 4 жыл бұрын
Really clear sir. Thank you.
@saifaldeenal7451
@saifaldeenal7451 6 жыл бұрын
Thank a lot teacher, But how can I display the only subclass constructor output without having the superclass constructor output ?
@rbrojas2040
@rbrojas2040 3 жыл бұрын
Can you specify the super method from the main method? Or do you have to manually change super() within class B only?
@ThierryBitz
@ThierryBitz 4 жыл бұрын
Perfect explanation!
@Explore-world-
@Explore-world- 6 жыл бұрын
learned lot from your tutorial thanks bro
@keerthigakeerthi7140
@keerthigakeerthi7140 5 жыл бұрын
It helps a lot!!
@zeynep8152
@zeynep8152 3 жыл бұрын
thank you you helped me bro
@Manoj-qf6lq
@Manoj-qf6lq 5 жыл бұрын
Is it necessary to give public at the creation of constructor?
@NarasimhaRaju-ge4si
@NarasimhaRaju-ge4si Жыл бұрын
Bro you are a java johny sins U feked every side of java 🙏
@Rajat-Sharma1
@Rajat-Sharma1 5 жыл бұрын
1:35 just for my reference
@MuditDahiya
@MuditDahiya 3 жыл бұрын
Can you give an example where this method would be useful?
@teluskosupport1
@teluskosupport1 Жыл бұрын
if you have constructor overloading means have multiple constructor in same class and you want to use more than one constructor then use this() method to chain the constructor.
@visiontwo8050
@visiontwo8050 4 жыл бұрын
should you say instead of system out ..... int should'nt be " i " instead of the cast (int) but the variable ' i '
@peterfernandes9011
@peterfernandes9011 4 жыл бұрын
Awesome!!!
@priyasingarapu
@priyasingarapu 6 жыл бұрын
Sir...can u plz upload testing tutorials...I wanna learn selenium from your tutorials
@brankoblesicjr.5792
@brankoblesicjr.5792 4 жыл бұрын
wow thx man
@brandonflorida1092
@brandonflorida1092 4 жыл бұрын
Well done!
@saisrisai9649
@saisrisai9649 5 жыл бұрын
Thank u very much sir
@professionalsir8501
@professionalsir8501 4 жыл бұрын
Telusko is nothing but Tell....usko👉👉 😎😎
@real_hello_kitty
@real_hello_kitty 4 жыл бұрын
Thanks!
@asifsaad5827
@asifsaad5827 3 жыл бұрын
best one ever!
@JahangirAlam-uw1mc
@JahangirAlam-uw1mc 6 жыл бұрын
very nice ... sir...
@gradedgodly
@gradedgodly 6 жыл бұрын
Sir, have you written any book? I wanna buy.
@pud99
@pud99 6 жыл бұрын
Just Awesome!!
@harshalikapadnis603
@harshalikapadnis603 6 ай бұрын
Where we get full course of java,oop
@ahmednafiunoman5040
@ahmednafiunoman5040 5 жыл бұрын
much informative video
@ahmednafiunoman5040
@ahmednafiunoman5040 3 жыл бұрын
after two years , i am again here hahahah
@damodaranm3044
@damodaranm3044 5 жыл бұрын
do you know why youre still under 1m subscribers though youre teaching style is good . youre simply rushing up . im revising the Java oops still im unabl to track what youre saying . but if im a begineer i would simply skip this video off searching for someother video what makes me understand. pls dont rush up . simply go slow cuz we are begineers
@armanmalkhasyan4765
@armanmalkhasyan4765 4 жыл бұрын
Thank you!
@jw200
@jw200 4 жыл бұрын
Subscribed!
@pratush.mishra
@pratush.mishra 4 жыл бұрын
Great
@ArkoSarkar1
@ArkoSarkar1 6 жыл бұрын
2:30 creating object of B calls constructor of A then B, but creates object of A too or not?
@teluskosupport1
@teluskosupport1 Жыл бұрын
creating of constructor A means it calls first object class constructor then own class constructor because object class is parent of every class.
@ramprasad8586
@ramprasad8586 4 жыл бұрын
Thala great!!
@ashutoshanand4040
@ashutoshanand4040 5 жыл бұрын
Sir does it work with functions or methods ?
@teluskosupport1
@teluskosupport1 Жыл бұрын
super keyword work with methods but super() method use only in constructor
@vijaynath1986
@vijaynath1986 6 жыл бұрын
Thanks java guru
@milaismyname
@milaismyname 6 жыл бұрын
What about B obj1 = new A(); ? Can you please make some videos for Polymorphism?
@manveersingh5822
@manveersingh5822 6 жыл бұрын
if b extends a, then the above statement is wrong.
@teluskosupport1
@teluskosupport1 Жыл бұрын
this is know as loose coupling in java . It can achieve only by inheritence. reference type is parent type and object type is child type.
@IamInEmpireBusiness
@IamInEmpireBusiness 6 жыл бұрын
zabardast
@pankajchandel1000
@pankajchandel1000 2 жыл бұрын
Why it is not printing.. in A.. at 6:35
@teluskosupport1
@teluskosupport1 Жыл бұрын
because we passing one parrameter with super method that means we want call that consttructor which has one parameter.
@suryanshgr4610
@suryanshgr4610 6 жыл бұрын
public class Cal { public void calc(int x, int y, String s){ switch(s){ case "add": System.out.println( x + y); break; case "sub": System.out.println( x - y); break; case "product": System.out.println( x * y); break; case "divide": double n = x/y; System.out.println(n); break; default: System.out.println("please enter right operation"); } } } class MyClass{ public static void main(String[] args){ Cal re = new Cal(); re.calc(34, 56, "product"); } }
@teluskosupport1
@teluskosupport1 Жыл бұрын
1904 is result becuase case Product is matched
@yousuf401
@yousuf401 2 жыл бұрын
still confused
@saikatpaul1344
@saikatpaul1344 4 жыл бұрын
Wow
@devilmachine.490
@devilmachine.490 2 жыл бұрын
Sir live class kese le sakte h apse??
@Telusko
@Telusko 2 жыл бұрын
bit.ly/javatelusko
@wojtekyt6690
@wojtekyt6690 6 жыл бұрын
Great!
@rashmiambedkar5143
@rashmiambedkar5143 6 жыл бұрын
pls add video to validate dropdown (ul/li)
@visiontwo8050
@visiontwo8050 4 жыл бұрын
never mind im still learning...
@kumarnavit9355
@kumarnavit9355 6 жыл бұрын
Hindi me bhi bnaeye jyada viewers mil skte hai i think
#6.3 Java Tutorial | Multiple Inheritance in Java?
2:28
Telusko
Рет қаралды 80 М.
#51 This and Super Method in Java
12:11
Telusko
Рет қаралды 102 М.
English or Spanish 🤣
00:16
GL Show
Рет қаралды 7 МЛН
Schoolboy Runaway в реальной жизни🤣@onLI_gAmeS
00:31
МишАня
Рет қаралды 4 МЛН
Super Keyword in Java Full Tutorial - How to Use "super"
11:33
Coding with John
Рет қаралды 202 М.
#4.2 Constructor in Java Theory
10:55
Telusko
Рет қаралды 413 М.
Java Super Keyword Tutorial #87
15:00
Alex Lee
Рет қаралды 228 М.
Learn JavaScript CLASSES in 6 minutes! 🏭
6:09
Bro Code
Рет қаралды 47 М.
#4.6 Java Tutorial | Static Keyword
12:20
Telusko
Рет қаралды 454 М.
#42 This keyword in Java
9:45
Telusko
Рет қаралды 128 М.
Abstract Classes and Methods in Java Explained in 7 Minutes
7:00
Coding with John
Рет қаралды 505 М.
Java super keyword 🦸‍♂️
8:09
Bro Code
Рет қаралды 93 М.
#61 Abstract Keyword in Java
12:09
Telusko
Рет қаралды 143 М.