No video

Can we override a static method in child class? || Famous Interview Question

  Рет қаралды 45,841

Naveen AutomationLabs

Naveen AutomationLabs

Күн бұрын

Can we override a static method in child class? || Famous Interview Question
Static methods can not be overridden in the exact sense of the word, but they can hide parent static methods
In practice it means that que compiler will decide which method to execute at compile time, and not in runtime, as it does with overridden instance methods.
For a neat example have a look here.
And this is java documentation explaining the difference between overriding instance methods and hiding class (static) methods.
Overriding: Overriding in Java simply means that the particular method would be called based on the run time type of the object and not on the compile time type of it (which is the case with overriden static methods)
Hiding: Parent class methods that are static are not part of a child class (although they are accessible), so there is no question of overriding it. Even if you add another static method in a subclass, identical to the one in its parent class, this subclass static method is unique and distinct from the static method in its parent class. Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
www.youtube.co...
Follow me on my Facebook Page:
/ naveenqtpexpert
Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
t.me/joinchat/...
Paid courses (Recorded) videos:
Java & Selenium Course: www.naveenautom...
API Course: www.naveenautom... ➡️Get Our Courses✔️
📗 Get My Paid Courses at
Paid courses (Recorded) videos:
Java & Selenium Course: www.naveenautom...
API Course: www.naveenautom...
-------------------------------
✔️SOCIAL NETWORKS
Facebook: / naveenqtpexpert
Twitter: / naveenkhunteta
Blog: www.naveenautom...
--------------------------------
Support My Channel✔️Or Buy Me A Coffee
Paypal: paypal.me/nave...
Google Pay: naveenanimation20@gmail.com
--------------------------------
✔️Thanks for watching!
देखने के लिए धन्यवाद
Благодаря за гледането
感谢您观看
Merci d'avoir regardé
Grazie per la visione
Gracias por ver
شكرا للمشاهدة

Пікірлер: 36
@shindeajinkya2506
@shindeajinkya2506 2 жыл бұрын
Truly appreciate 🙏.... Covered 3 or 4 imp questions in one concept thanks sir .... God bless u❤💯 1. Static method overriding ? 2. Main method overloading ? 3. Method hiding ? 4. Static method overloading ? Got all concepts....💯🤞
@SarangHoley
@SarangHoley 5 жыл бұрын
All Clear with very Simple and easy to understandable Example 👍😊
@nagasaimaddula56
@nagasaimaddula56 4 ай бұрын
Thanks for the easy explanation .
@ayushgarg4327
@ayushgarg4327 5 жыл бұрын
Bahut badiya video . Really appreciate your efforts 👌👌👌👌👌🙏🙏🙏🙏
@sumitgoyal385
@sumitgoyal385 4 ай бұрын
good one ,method hiding finally cleared after 3 yrs
@ExperienceLife007
@ExperienceLife007 5 жыл бұрын
God will always bless you !! You are doing the best job .. thank you
@akshaybhatia7977
@akshaybhatia7977 5 жыл бұрын
Amazing stuff Naveen. The way you taught is commendable.
@khajazakiuddin931
@khajazakiuddin931 5 жыл бұрын
very clear explanation and easily understood...👏😊
@reenamokha
@reenamokha 5 жыл бұрын
Such a fantastic explanation!! Thanks
@OdiaTalesBySwarna
@OdiaTalesBySwarna 5 жыл бұрын
God bless you Mr Naveen..u r really helping lot of people.🙏
@pranay819
@pranay819 2 жыл бұрын
I have 2 questions - In case of method hiding - 1. Cant we access the parent class method using Super keyword? Or 2. Directly parentclass.method name? Thanks
@simplesdtips8770
@simplesdtips8770 5 жыл бұрын
Thanks for explaining it clearly..
@swapnilbodade1336
@swapnilbodade1336 5 жыл бұрын
You are simply awesome 😎
@Lipunknb
@Lipunknb 3 жыл бұрын
Thanks a lot..very well explained
@TheJami2010
@TheJami2010 5 жыл бұрын
Amazingly done! Thanks a lot for helping us.
@arunkumarcherukuru2213
@arunkumarcherukuru2213 5 жыл бұрын
Dislikes are from other KZfaq channels
@sivajames07
@sivajames07 3 жыл бұрын
Thanks...I'm clear now
@ADIL7777777777777777
@ADIL7777777777777777 4 жыл бұрын
nice explanation naveen thx :)
@archanagupta2862
@archanagupta2862 3 жыл бұрын
Nice explanation 👍
@mahendratestingfy
@mahendratestingfy Жыл бұрын
Can we inherit static members ? As of my knowledge no we can't But in the internet i am getting yes and no both answers Which one is correct ? Can we inherit or not ?
@MultiPrasad99
@MultiPrasad99 5 жыл бұрын
Awesome explanation
@umeshjoshi8047
@umeshjoshi8047 3 жыл бұрын
please also explain why we can't override the static method
@mariabajwa8632
@mariabajwa8632 5 жыл бұрын
thanks.
@venkatapk6603
@venkatapk6603 3 жыл бұрын
Thank you bro
@sandeepbandoju6785
@sandeepbandoju6785 5 жыл бұрын
hi sir can u plz explain about BUT keyword and * in cucumber framework
@mohanrajdandy
@mohanrajdandy Жыл бұрын
Overriding main method not possible right, may i know why
@Sear-hh4gf
@Sear-hh4gf 3 жыл бұрын
Thanks so much Naveen, for clearing this.
@thiery572
@thiery572 5 жыл бұрын
Thanks.
@ravireddyism
@ravireddyism Жыл бұрын
7.36 " it says the method start of type BMV must implement or override the super class method " this is what you are doing . it didn't tell us to not use static method. However you have to tell your students why you should not use static methods. I'm waiting for anyone to clarify.
@vengateshm2122
@vengateshm2122 3 жыл бұрын
Can we mark the method as final in super class for method hiding.
@naveenautomationlabs
@naveenautomationlabs 3 жыл бұрын
Yes, you can make final method in parent class to prevent method overriding. But this is not method hiding. Method hiding is when you have a static method in parent class and same static method in child class (this is not method overriding). This is method hiding in Java.
@vengateshm2122
@vengateshm2122 3 жыл бұрын
@@naveenautomationlabs Thank You.
@shareefshaik6057
@shareefshaik6057 5 жыл бұрын
Only word "FIDA" :)
@kishanchakra
@kishanchakra 5 жыл бұрын
Question: Why can't we override static method?
@ashishkumarmishra2346
@ashishkumarmishra2346 4 жыл бұрын
Static means common..So anything is declared as Static means its common to all, meaning anyone can use without any permission just use it that's why you declared the method as static use it without changing in implementation part. But when you override any method this means you are changing the implementation part although the method name and signature are the same.That's the reason the static method cannot be overridden.
@dilrubaahmed8302
@dilrubaahmed8302 Жыл бұрын
Hello, Can anyone please tell me any video to learn REGEX for testers?
Java Program to Count Number of Duplicate Words in Given String
16:40
Naveen AutomationLabs
Рет қаралды 61 М.
Different ways of iterating an ArrayList || Important Java Interview Question
16:37
wow so cute 🥰
00:20
dednahype
Рет қаралды 30 МЛН
Blue Food VS Red Food Emoji Mukbang
00:33
MOOMOO STUDIO [무무 스튜디오]
Рет қаралды 17 МЛН
а ты любишь париться?
00:41
KATYA KLON LIFE
Рет қаралды 3,6 МЛН
If Barbie came to life! 💝
00:37
Meow-some! Reacts
Рет қаралды 78 МЛН
#52 Method Overriding in Java
7:57
Telusko
Рет қаралды 131 М.
Difference between Interface and Absract Class
30:52
Naveen AutomationLabs
Рет қаралды 180 М.
Multiple static methods inside a single Class | How to deal it?
11:18
SoftwaretestingbyMKT
Рет қаралды 16 М.
This and Super keywords with Constructor Examples In Java
57:03
Naveen AutomationLabs
Рет қаралды 83 М.
Java Tutorials || Java OOPS  ||Method Hiding || by Durga Sir
16:32
Durga Software Solutions
Рет қаралды 37 М.
02. Equals and HashCode Contract & Different Variations
11:19
WebEncyclop Tutorials
Рет қаралды 56 М.
Java - Part 257 - Method Hiding
16:18
QAFox
Рет қаралды 4,2 М.
Why String is Immutable and Final in Java?
19:59
Naveen AutomationLabs
Рет қаралды 87 М.
What are Static methods in JavaScript
10:44
procademy
Рет қаралды 10 М.
wow so cute 🥰
00:20
dednahype
Рет қаралды 30 МЛН