@ page: 21

@ quote
● Interfaces and classes are both types
- This means that an interface can be used in places
where a class can be used
- For example:
// Recommended practice
PersonInterface pi = new Person();
// Not recommended practice
Person pc = new Person();

Question:
Why is using an interface as type is recommended over class? I cannot
see the advantage of doing so.

Thank you.

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to