• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

is this true?

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
a public static method in a class can be called by its subclass wihtout explicitly refreing to the class???
if true then help me undersatnd this
thanks in advance!!!
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by geet kaur:
a public static method in a class can be called by its subclass wihtout explicitly refreing to the class???
if true then help me undersatnd this
thanks in advance!!!



Well, have you actually tried it? It just takes a few minutes to write a test program.

Henry
 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. Its because static methods cannot be overridden. And since the subclass actually HAS the superclass, ie.Superclass's methods are a part of the subclass, and since there is only one copy of the static method, you can call the static method in the subclass without the parent's object.
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by geet kaur:
a public static method in a class can be called by its subclass wihtout explicitly refreing to the class???
if true then help me undersatnd this
thanks in advance!!!



hmmm...also public is not necessary...
 
reply
    Bookmark Topic Watch Topic
  • New Topic