can any one explain me how interfaces provides encapsulation
my miss says me :
when you write some thing like // where Shape is an interface , it actually provides encapsulation because user can only see that s is of type Shape and not which object is getting created .
Interface don't provide encapsulation. They can provide flexibility and information-hiding.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Interfaces are also Java's way of dealing with the issues surrounding multiple-inheritance, such as those experienced by C++ (i.e. the "diamond" problem").
Just search for those terms, you'll find a ton of information.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.