can a static method be overridden
Answer Posted / karthik narayanan
also when you implement the same static method, in both
parent and subclass , and if you an instance of subclass and
say if your instance.thatstaticMethod(), the subclass
version will execute, but now if you typecast subclass to
the parent class and then execute
parentInstance.thestaticMethod() the parents version will
execute. this is different from overriding where even if
you typecast , the subclass version of the method will
execute. So basically, you can hide a static method
execution from a subclass, but you cannot override it.
understand???
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
what are getters and setters in Java with examples?
What is RMI and what are the services in RMI?
What is difference between object state and behavior?
What method is invoked to cause an object to begin executing as a separate thread?
What are the types of scaling?
What is TL and its use?
How would you create a button with rounded edges?
What is the difference between the font and fontmetrics classes?
What is colon_pkg_prefixes and what is its use?
Difference between DurableSubscription and non- DurableSubscription?
Why use POJO when I can use hashmap
Explain the different types of memory used by jvm?
How to determine SGA site?
What is the difference between RMI registry and OS Agent?
What is the relationship between the canvas class and the graphics class?