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 trialYong Li Soh
Courses Plus Student 2,555 PointsWhat does "All Implemented Interfaces" in Java Documentation mean?
The following is the front part of the code for from this video:
import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List;
public class Treet implements Comparable<Treet>, Serializable{
In the Java Documentation for Class ArrayList, it states All implemented Interfaces: Serializable, ..., etc. So I assume that Serializable is implemented once you import ArrayList.
The question is why do we need to type" import java.io.Serializable;" and "implements Serializable"?
1 Answer
Kathryn Ann
10,071 PointsYou still need to import the interfaces and type "implements Comparable, Serializable" to implement those interfaces for the Treet class, since you're defining that class in your code. You don't need to type them for ArrayList because that class has already been defined as implementing the interfaces.
Yong Li Soh
Courses Plus Student 2,555 PointsYong Li Soh
Courses Plus Student 2,555 PointsThanks for explaining. I get it now!