Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

Importing or implementing interfaces

Hello, on the "serialization" Craig imported the interface, but in the previous video he didn't import the Comparable interface. So... when do we need to import an interface and when do we need to implement it??

Nancy Melucci
Nancy Melucci
Courses Plus Student 36,159 Points

The short answer, which I got from web search, is that it depends on whether the interface is in the package already. If it is, you don't have to import it, but if it is not, you will.

Credit where it's due, and more detailed info from this source:

http://tutorials.jenkov.com/java/interfaces.html