This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes is this true? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "is this true?" Watch "is this true?" New topic
Author

is this true?

geet kaur
Ranch Hand

Joined: Sep 03, 2008
Posts: 78
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
Sheriff

Joined: Sep 28, 2004
Posts: 18542
    
  40

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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Rekha Srinath
Ranch Hand

Joined: Sep 13, 2008
Posts: 178
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

Joined: Jan 28, 2008
Posts: 5575

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...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is this true?
 
Similar Threads
Best way to represent cards?
Static question
nested class
does interface gets converted to abstractclass at compile time or runtime
IMP!- can, boolean literals (true, etc),unused reserved words,BE CALLED Keywords ?