• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Static methods and variables

 
Neelima Mohan
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am able to access my static variables and methods declared/defined in the superclass from my subclass, then why is it said that static methods cannot be overridden? I can easily override that method in my subclass.

Thanks,
neelima
 
Rob Spoor
Sheriff
Pie
Posts: 20493
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's called shadowing or hiding. See Overriding vs Hiding.
 
Tom Reilly
Rancher
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are not overriding them, just creating methods and variables with the same name.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic