Java Programming - Use Interface as a type

Veröffentlicht am: 13 April 2020
auf dem Kanal: RioProfessor Liu
393
5

Rio Hondo College
CIT 136 Java Programming class
Interface Introduction ---
An interface is a reference type in Java. It is similar to class. It is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface.
When you define a new interface, you are defining a new reference data type. You can use interface names anywhere you can use any other data type name. If you define a reference variable whose type is an interface, any object you assign to it must be an instance of a class that implements the interface.
Any class implements the Measurable Interface can use the average method to calculate the average of the objects.

Class Student implements Measurable Interface with the getMeasure() method to calculate the average of students scores.
Class BankAccount implements Measurable Interface with the getMeasure() method to calculate the average of the balance

Professor Liu


Auf dieser Seite können Sie das Online-Video Java Programming - Use Interface as a type mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer RioProfessor Liu 13 April 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 393 Mal angesehen und es wurde von 5 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!