Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why can't we declare a protected fields in interface?

 
jayaprakash kaluva
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Why can't we declare variables in interface as "PROTECTED".
 
Campbell Ritchie
Sheriff
Posts: 48424
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Because an interface is intended to create (part of) the public interface of a class. Everything in an interface is therefore implicitly public.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic