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 is the difference between system.out ,system.err and system.in?
Why doesn’t the focus feature on the tag work in every circumstance?
How many times may an objects finalize() method be invoked by the garbage collector?
what are the activation groupworks?
Are we allowed to change the transaction isolation property in middle of a transaction?
What is the immediate superclass of the applet class?
What class is the top of the awt event hierarchy?
whats is mean by connectionpooling
What if the static modifier is removed from the signature of the main method?
Why do threads block on i/o?
What are local interfaces? Describe.
What are externizable interface?
How can I scroll through list of pages like the search results in google?
int x=5,i=1,y=0; while(i<=5) { y=x++ + ++x; i=i+2; } System.out.println(x); System.out.println(y); System.out.println(i); How to solve this? Please explain!
What class is used to create Server side object ?