File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Abstract Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Abstract" Watch "Abstract" New topic
Author

Abstract

Ram Jonnalagadda
Greenhorn

Joined: Nov 05, 2000
Posts: 6
Hai,
Someboby clarify my doubt.
Can u combine abstract with any other modifiers like private,static in a class or method declarations
thanks
bye
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Abstract methods must be overridden by subclasses to provide implementation. Since private methods are not visible in subclasses abstract methods cannot be private. Similarly, since static methods cannot be overridden, they cannot be static either.
Try out this code and see what the compiler says -

Ajith


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Ram Jonnalagadda
Greenhorn

Joined: Nov 05, 2000
Posts: 6
Hai Ajith Kallambella
Thanks for ur response.
But is it true that Static methods must be overridden to be Static.They can't be overridden to be non static.

Need some response
thanks
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
No. Static methods cannot be overridden at all.
Here's why - Unlike instance methods which is associated with the objects of a particular class, static methods( and static variables ) are associated with the class itself. So, when a class is subclassed, if the superclass contains static entities( methods/variables ), they are not inherited in the subclass. You can only override something that is inherited and hence static entities cannot be overridden.
What's more, static methods are resolved at compile time and (since they cannot be overridden, ) they do not exhibit polymorphism (aka runtime binding ).
Often people get confused between overriding and redeclaration. Static methods can be redeclared in the subclass and when you do so, the new method shadows or hides the method in the superclass.
Hope that helps,
Ajith
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Abstract
 
Similar Threads
difference between BufferedInputStream(or output) and other i/ostreams,regarding buffers.
Reg. native methods
WA #1.....word association
ABSTRACT
Tech Word Game