No video

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

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

Naveen AutomationLabs

Naveen AutomationLabs

5 жыл бұрын

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:
kzbin.info%20Au...
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/COJqZUPB02r5sB7...
Paid courses (Recorded) videos:
Java & Selenium Course: www.naveenautomationlabs.com/p...
API Course: www.naveenautomationlabs.com/p... ➡️Get Our Courses✔️
📗 Get My Paid Courses at
Paid courses (Recorded) videos:
Java & Selenium Course: www.naveenautomationlabs.com/p...
API Course: www.naveenautomationlabs.com/p...
-------------------------------
✔️SOCIAL NETWORKS
Facebook: / naveenqtpexpert
Twitter: / naveenkhunteta
Blog: www.naveenautomationlabs.com
--------------------------------
Support My Channel✔️Or Buy Me A Coffee
Paypal: paypal.me/naveenkhunteta
Google Pay: naveenanimation20@gmail.com
--------------------------------
✔️Thanks for watching!
देखने के लिए धन्यवाद
Благодаря за гледането
感谢您观看
Merci d'avoir regardé
Grazie per la visione
Gracias por ver
شكرا للمشاهدة

Пікірлер: 36
@sumitgoyal385
@sumitgoyal385 3 ай бұрын
good one ,method hiding finally cleared after 3 yrs
@nagasaimaddula56
@nagasaimaddula56 4 ай бұрын
Thanks for the easy explanation .
@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 👍😊
@ExperienceLife007
@ExperienceLife007 5 жыл бұрын
God will always bless you !! You are doing the best job .. thank you
@ayushgarg4327
@ayushgarg4327 5 жыл бұрын
Bahut badiya video . Really appreciate your efforts 👌👌👌👌👌🙏🙏🙏🙏
@TheJami2010
@TheJami2010 5 жыл бұрын
Amazingly done! Thanks a lot for helping us.
@reenamokha
@reenamokha 5 жыл бұрын
Such a fantastic explanation!! Thanks
@akshaybhatia7977
@akshaybhatia7977 5 жыл бұрын
Amazing stuff Naveen. The way you taught is commendable.
@simplesdtips8770
@simplesdtips8770 5 жыл бұрын
Thanks for explaining it clearly..
@khajazakiuddin931
@khajazakiuddin931 5 жыл бұрын
very clear explanation and easily understood...👏😊
@swapnilbodade1336
@swapnilbodade1336 5 жыл бұрын
You are simply awesome 😎
@MultiPrasad99
@MultiPrasad99 4 жыл бұрын
Awesome explanation
@Lipunknb
@Lipunknb 3 жыл бұрын
Thanks a lot..very well explained
@archanagupta2862
@archanagupta2862 3 жыл бұрын
Nice explanation 👍
@OdiaTalesBySwarna
@OdiaTalesBySwarna 5 жыл бұрын
God bless you Mr Naveen..u r really helping lot of people.🙏
@ADIL7777777777777777
@ADIL7777777777777777 4 жыл бұрын
nice explanation naveen thx :)
@sivajames07
@sivajames07 3 жыл бұрын
Thanks...I'm clear now
@thiery572
@thiery572 5 жыл бұрын
Thanks.
@venkatapk6603
@venkatapk6603 3 жыл бұрын
Thank you bro
@mariabajwa8632
@mariabajwa8632 5 жыл бұрын
thanks.
@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
@arunkumarcherukuru2213
@arunkumarcherukuru2213 5 жыл бұрын
Dislikes are from other KZbin channels
@mohanrajdandy
@mohanrajdandy Жыл бұрын
Overriding main method not possible right, may i know why
@sandeepbandoju6785
@sandeepbandoju6785 5 жыл бұрын
hi sir can u plz explain about BUT keyword and * in cucumber framework
@umeshjoshi8047
@umeshjoshi8047 3 жыл бұрын
please also explain why we can't override the static method
@dilrubaahmed8302
@dilrubaahmed8302 Жыл бұрын
Hello, Can anyone please tell me any video to learn REGEX for testers?
@Sear-hh4gf
@Sear-hh4gf 3 жыл бұрын
Thanks so much Naveen, for clearing this.
@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 ?
@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" :)
@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.
@kishanchakra
@kishanchakra 4 жыл бұрын
Question: Why can't we override static method?
@ashishkumarmishra2346
@ashishkumarmishra2346 3 жыл бұрын
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.
Java Program to Count Number of Duplicate Words in Given String
16:40
Naveen AutomationLabs
Рет қаралды 60 М.
Different ways of iterating an ArrayList || Important Java Interview Question
16:37
لقد سرقت حلوى القطن بشكل خفي لأصنع مصاصة🤫😎
00:33
Cool Tool SHORTS Arabic
Рет қаралды 29 МЛН
#52 Method Overriding in Java
7:57
Telusko
Рет қаралды 125 М.
What is Encapsulation in Java - OOP Concept
19:44
Naveen AutomationLabs
Рет қаралды 71 М.
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
Multiple static methods inside a single Class | How to deal it?
11:18
SoftwaretestingbyMKT
Рет қаралды 16 М.
Explain about public static void main(String[] args); ( PART- I )
28:14
DURGA EDUCATION
Рет қаралды 667 М.
Difference between Interface and Absract Class
30:52
Naveen AutomationLabs
Рет қаралды 179 М.
Can we overload a main() method in Java? || Java Interview Question
13:24
Naveen AutomationLabs
Рет қаралды 59 М.
Java Tutorials || Java OOPS  ||Method Hiding || by Durga Sir
16:32
Durga Software Solutions
Рет қаралды 37 М.