+ 8

Can we override Static method?

1st Sep 2018, 1:04 PM
Slim Jxmmi
6 Respuestas
+ 5
Static methods can not be overridden because they are not part of the object's state. Rather, they belongs to the class (i.e they are class methods). It is ok to overload static (and final)methods. No,Static methods can't be overriden as it is part of a class rather than an object. more details here. https://www.google.co.in/amp/s/www.geeksforgeeks.org/can-we-overload-or-override-static-methods-in-java/amp/
1st Sep 2018, 4:39 PM
Maninder $ingh
Maninder $ingh - avatar
+ 9
No, you can hide a static method. 💗 🙆‍♂️🤗
1st Sep 2018, 11:24 PM
NimWing Yuan
NimWing Yuan - avatar
+ 4
We can declare static methods with same signature in subclass, but it is not considered overriding as there won’t be any run-time polymorphism. Hence the answer is ‘No’.
1st Sep 2018, 1:10 PM
Potato Squad
Potato Squad - avatar
+ 2
A default method cannot override a method from java.lang.Object . The reasoning is very simple, it's because Object is the base class for all the java classes. So even if we have Object class methods defined as default methods in interfaces, it will be useless because Object class method will always be used.
2nd Sep 2018, 12:50 AM
BroFar
BroFar - avatar
+ 1
no
5th Nov 2018, 6:46 PM
Pls Dont Block Me
0
nope
3rd Sep 2018, 12:37 PM
Aarav Raj
Aarav Raj - avatar