File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Abstract methods and access modifier

 
Craig Oliver
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()
{
code
}
}
 
Darin Niard
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that is valid. You can always assign broader access, but not weaker access.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic