Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can we override static method

 
Pawan M
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I was reading queries posted by other so i got one doubt due to following sentences that
"You can "override" a non-final static method, although this is actually redefining it and hiding the original method."

but what i know that we can not override static method.
Am i correct or not,please clear my doubt? i have also created one program
but i am getting output-Overriden Meth
but in case of overriding it should print- Overriding Meth
 
Ravikanth kolli
Ranch Hand
Posts: 179
Chrome Eclipse IDE Mac
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Static method cannot be overridden in java.
Detailed explanation is given at

Overriding Vs Hiding

Thanks
hope that helps
 
Pawan M
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You very much.
Now i understood.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49390
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, "Pawan M," but please alter your displayed name to conform to the Ranch naming policy.
 
Abdul Aatif
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ravikanth kolli wrote:Static method cannot be overridden in java.
Detailed explanation is given at

Overriding Vs Hiding

Thanks
hope that helps



thank you very much
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic