• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is this true?

 
geet kaur
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • 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!!!
 
Henry Wong
author
Marshal
Pie
Posts: 21420
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • 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
 
Rekha Srinath
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • 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.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • 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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic