Thursday, March 12, 2009

Why is not recommended to have instance variables in Interface (CoreJava)

Question :Why is not recommended to have instance variables in Interface (CoreJava)
Answer :By Default, All data members and methods in an Interface are public.
Having public variables in a class that will be implementing it will be
violation of the Encapsulation principles

No comments: