• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Overriding rules  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, while studying overriding stuff I was a little confused, because literature is contradictory.
Can anybody help me through?
Can I override methods:
static - to be nonstatic
static - to be static
nonstatic - to be nonstatic
(I think yes)
non static - to be static
Any suggestion where this make sense in programs?
Thanks Tina
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tina,
Static method cannot be overridden( to non static).
But i guess u can hide a static method inside a sub class i.e you can declare a static method in the subclass with the same signature as a static method in the superclass.
[ December 16, 2002: Message edited by: girish rateshwar ]
 
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the JavaRanch Newletter there is an article called The Games Objects Play which has a section on Hide and Seek. That lists all the combinations of methods trying hiding and overriding and what happens if you try to do them.
Have Fun!!
 
Tina Low
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the help.
The games play (hiding/Overriding) was pretty good. It helped me to pass the SCJP2 Exam
on 10.1.03.
Thanks a lot Tina :roll:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!