• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Abstract cannot be protected

 
Sudhanshu Mishra
Ranch Hand
Posts: 236
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a little doubt here.Why can a default method be declare abstract but protected method cannot be declared abstract?
Interface methods cannot be declared protected because they are abstract implicitly.
But i think abstract methods could be declared protected,as they can veru well be inherited and overridden.
Please clarify...............
Thanks.
 
Winston Gutkowski
Bartender
Pie
Posts: 10091
56
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sudhanshu Mishra wrote:Why can a default method be declare abstract but protected method cannot be declared abstract?

What makes you think that?

Interface methods cannot be declared protected because they are abstract implicitly.

No. Interface methods cannot be declared protected because they are implicitly public.

But i think abstract methods could be declared protected,as they can veru well be inherited and overridden.

So...try it.

Winston
 
Sudhanshu Mishra
Ranch Hand
Posts: 236
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Winston.
I should have thought it.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic