Yes, cup1 is an object (or rather it's a variable referring to an object - just like cup2).
The biggest difference between cup1 and cup2 is that, if the Coffee class defines public methods in addition to those declared in CoffeeInterface, you will be able to call those on cup2, but not on cup1.
Another difference is that, if you have a method m that has one overload for Coffee and one for CoffeeInterface, then m(cup1) will call the overload for the interface while m(cup2) will call the overload for the class.
I think there's been a misunderstanding. I didn't say that the method m should be defined in the interface. The method can be defined in any class you want as long as it has two overloads: one for Coffe and one for CoffeeInterface.
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...