Using Interfaces as Types in Java: A Beginner’s Guide
This note explains how Java interfaces define new data types, how variables of an interface type must reference objects implementing that interface, and demonstrates the concept with a concrete example that casts objects to a Compare interface to select the larger one.
