I have two classes, and I would like for my second class to acces private data from the first class.
Normally I’d have:
public class GenericDictionary<T> implements GenericDictionary_interface<T> {
public class Iterator<T> extends GenericDictionary<T> {
But I have an interface, I don’t EXACTLY know how they work, sometimes they seem to not be necessary.
public class Iterator<T> implements Iterator_interface<T> {
How can I extend another class and have an interface ? Is the interface not needed ? should the interface of my Iterator<T> class be in the supper’s interface ? If so … how ?
P.S. please don’t lecture me on why I’m doing what I’m doing (aka making my own stuff instead of using the ones in java.util.*)
EDIT: Even though I decided to go with inner classes, the answer to my question is the order of extends and implements, thank you.
You put the
extendsfirst, then theimplements:For example, in the JDK,
java.util.ArrayListis given as(See its Javadoc.)