Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why static method can't override?

 
venka sai
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can some please explain me in detail why we can't override static methods?
 
Abdulla Mamuwala
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Time for a faq,
http://www.javaranch.com/certfaq.jsp#q20
 
Shubhada Nandarshi
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The static methods r those which doesn't need to have an object of their class to call them.They r created when their class gets compiled.We cant override them as a nonstatic methods.

Shubha.
 
P Hunjan
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also refer to ->http://www.jchq.net/certkey/0102certkey.htm

" The process of overriding involves more than simply replacing a method in a child class, it involves the runtime resolution of what method to call according to its reference type. "
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaspar, welcome to JavaRanch. Please take note of our JavaRanch Naming Policy and change your displayed name to conform with it. You can use the My Profile link.
Thanks,
-Barry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic