• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Overriding of Static Method

 
Faraz Alig
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to override the static method in subclass? If not then please explain why?


~ Faraz
 
Janeice DelVecchio
Saloon Keeper
Posts: 1809
12
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried? What happens?
 
Henry Wong
author
Marshal
Pie
Posts: 21418
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

To be more specific, create a subclass object, cast it to its superclass type, and try to call the static method... which one gets call? the original super class one? or the subclass version?

Henry
 
Schumi Mic
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Faraz: You can find this in-detail @ Overriding Vs Hidding
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic