
/**
 * This class implements the {@link SAM} interface by providing a definition for
 * the singleAbstractMethod that it requires. This is the old-fashioned and more
 * difficult way to create a SAM object. The quicker and easier way is to use a
 * lambda expression. See {@link UsesSAM} for an example.
 *
 * @author Mark Young (A00000000)
 */
public class ImplementsSAM implements SAM {

    @Override
    public void singleAbstractMethod(int num) {
        System.out.println("\n"
                + "This is a class that implements SAM.\n\n"
                + "What is SAM? I'm glad you asked!\n\n"
                + "SAM is an interface with a Single Abstract Method. "
                + "That is, it has exactly\none undefined method.\n\n"
                + "In this case, the undefined method is named\n\n"
                + "    singleAbstractMethod\n\n"
                + "and it takes an integer argument.\n\n"
                + "This class has the header:\n\n"
                + "    public class ImplementsSAM implements SAM\n\n"
                + "which promises that this class has a definition for "
                + "singleAbstractMethod. \n"
                + "It then actually includes a definition for that method -- "
                + "which is the\nmethod that is printing THIS VERY OUTPUT!\n\n"
                + "PS: the argument to this method was " + num + ".");
    }

}
