aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Abstract method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Abstract method" Watch "Abstract method" New topic
Author

Abstract method

Lancy Mendonca
Ranch Hand

Joined: Aug 08, 2000
Posts: 54
Had a small query about abstract method:
Why is it not possible to say
abstract class one
{
private abstract void f();
}
The compiler gives an error message

Sun Certified Java Programmer<BR>Oracle Certified DBA
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
The compiler gives an error because abstarct methods cannot be declared as private. Here's why -
Abstract classes are incomplete classes. Tagging a method as abstract indicates that the subclass needs to override the method to make the implementation complete. However, we also know private methods cannot be overridden because they are not visible outside the class. This makes abstract and private qualifiers mutually exclusive and hence they cannot be used together.
Hope this helps.
Ajith


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Lancy Mendonca
Ranch Hand

Joined: Aug 08, 2000
Posts: 54
Thanks Ajith. Your help is appreciated
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Abstract method
 
Similar Threads
design pattern for Strings to Objects
illegal combos
ABSTRACT
Why a non-abstract Parent Class can be extended by an abstract Child Class ?
A mock question