A Note on the Interface Concept

At Monday's lecture, I presented the concept of interface in Java. It is an important concept in Object-Oriented Programming and I hope that it aids your understanding of, e.g., the difference between Map and HashMap in the Java libraries instead of being confused by meeting the concept of interface without having been told about it.

However, I should point out that it is NOT part of the curriculum ("pensum"), so feel free to ignore it.

So those who readily understand the concept, they are free to write, e.g.,:

   Map<Strring, Course> myCourses = new HashMap<String, Course>();

And those who are confused by the concept, can merely use:

   HashMap<Strring, Course> myCourses = new HashMap<String, Course>();

Eric

Publisert 25. okt. 2016 16:23