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 Java Data Structures Organizing Data Serialization

Liron Tal
Liron Tal
4,825 Points

Why Comparable does not require importing while Serializable does?

Please help :)

1 Answer

deckey
deckey
14,630 Points

Hi Liron, simple answer would be that Comparable interface is part of java.lang package which holds fundamental classes in Java. (e.g. always available, holding essential classes like Boolean, Double etc..)

Serializable on the other hand is part of java.io package which needs to be imported.

hope it helps, good luck !