Interface
Interface Declaration, Inheritance, Implementation
-In Java programming aspect, interface is a group of abstract methods. It also includes static method, inheritance, default methods.
-Interface connects objects. Java를 활용한 Spring을 배울 때 인터페이스에 대해 혼동하지 말자.
-There is nothing implemented in interface.
-All of members are public.
Encapsulation : t.hour(x) . t.getHour(o)
Difference between interface and abstract class
Abstract class : The class that has abstract methods. It has not only abstract methods, but also constructor and iv(instance variable/instance method).
Interface : The one that only have abstract methods. It cannot have any other things.
Interface Declaration
interface CANNOT have variable such as iv, cv...
interface ALWAYS have public static final.(no exception, always constant.)
interface ALWAYS have public abstract methods.
Interface Inheritance
-Interface parent can be only interface.(Object is not the root.)
-Multiple inheritance is possible : Java is single inheritance because conflict between same name from different classes and different implementation. But when it comes to abstract method, even though it is same name, it has no implemented part so it does not matter.
-It is same as implementing abstract class by inheritance using "extends". The only difference is using keyword "implements"
-Implement(Complete) abstract method.
Last updated