File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Abstract methods and access modifier Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Abstract methods and access modifier" Watch "Abstract methods and access modifier" New topic

Abstract methods and access modifier

Craig Oliver

Joined: Aug 25, 2003
Posts: 21
If abstract class declares abstract method what are rules regarding access modifier to implementation of method in concrete subclass? ie if abstract method declared as default (package) can subclass implementation be public (wider access)?

eg is following valid
public abstract class Test
abstract void m1();

public class SubTest extends Test
public void m1()
Darin Niard
Ranch Hand

Joined: Jun 08, 2004
Posts: 118
Yes, that is valid. You can always assign broader access, but not weaker access.
I agree. Here's the link:
subject: Abstract methods and access modifier
It's not a secret anymore!