Java: Interfaces

Photo by Killian Cartignies on Unsplash

What is a reference type?

Reference data types in Java are those which contain references to the address of dynamically created objects. class types, arrays types, interface types.

Figure 1.1: Comparable Interface
Figure 1.2: Implementing the Comparable Interface
Figure 2.1: Using an interface as a data type

Defining a new interface, defines a new reference type.

Figure 2.2: Interface as parameter type and return type

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store