So I have these classes,
Exception1.java, Exception2.java, LinkedList.java, Iterator.java
LinkedList needs Iterator, Iterator needs exceptions and exceptions are independent.
So I put them in folder like this -
MyProject
__________________|____________________
/ | \
LinkedList.java MyIterator.java MyExceptions
___________|__________
/ \
Exception1.java Exception2.java
Now how should I name the packages and import them in between them, such that, I can make a test.java outside of MyProject and use LinkedList class?
Answer :
I linked them like this.
LinkedList : package MyProject; import MyProject.MyExceptions.*;
MyIterator : package MyProject; import MyProject.MyExceptions.*;
Exception1 : package MyProject.MyExceptions;
Exception2 : package MyProject.MyExceptions;
test : import MyProject.*; import MyProject.MyExceptions.*;
MyIteratorinner class ofLinkedListand make it implement standard Iterator class.