This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Java in General and the fly likes Abstract cannot be protected Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Abstract cannot be protected" Watch "Abstract cannot be protected" New topic
Author

Abstract cannot be protected

Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 217

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

Joined: Mar 17, 2011
Posts: 8060
    
  22

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

Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 217

Thanks Winston.
I should have thought it.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Abstract cannot be protected