William M. answered 06/17/24
STEM Tutor (Ph.D, Northwestern) | Algebra–Calc, Bio, Chem, Physics, CS
You clearly have never read the book JAVA PRECISELY by Peter Sestoft.
Go to the section on Java Collections (with the interfaces, abstract classes and concrete classes used for Collections), and study the relationships between all of them.
Ask yourself a couple of questions:
What is an interface? What is it used for? Does it have code associated with it? Can an interface inherit from an interface?
What is an abstract class? What is it used for? Does it have code associated with it? Can an abstract class inherit from an interface? Can it inherit from another abstract class? Can it implement an interface?
What is a concrete class? What is it used for? Does it have code associated with it? Can a concrete class inherit from another concrete class? Can it inherit from an interface? How many concrete or abstract classes can it inherit from? How many interfaces can it implement?
Then go through some of the Collection classes in Java, and answer all of the above questions
And write some code that creates a List interface to a concrete LinkedList class, and see how it answers all of the above questions.
But more importantly, write code that uses all of the above concepts.
Write your own interfaces.
Write your own concrete and abstract classes.
Refactor them to move functionality up the hierarchy and assess the effectiveness of the above.