Flashcards
Interface
Flashcards do conjunto (4)
- 1What is an interface?- Blueprint of a class
- Collection of Abstract Methods
- Contract between the class and outside world
- is a relationship - 2Difference between Abstract Class and InterfaceAbstract:
- Abstract and non abstract methods
- Final, non-final, static, non-static variables
- Members like private, protected
- Extend class, implement multiple interfaces
Interface:
- Abstract methods
- Static and final variables by default
- public by default
- Only another Interface can extend an interface - 3Static Methods in Interface- The keyword is "static"
- Can have any number of static methods
- Can't override the static method
- Can't define method of java.lang.Object as static methods
- For common behavior static methods are used
- Using interface name static methods are called
- From Java 9 onwards in Interfaces we can create private methods and private static methods (to have higher code reusability) - 4Comparison Java 7, Java 8 and Java 9Java 7:
- Constant variables
- Abstract methods
Java 8:
- Constant variables
- Abstract methods
- Default methods
- Static methods
Java 9:
Constant variables
- Abstract Methods
- Default Methods
- Static Methods
- Private Methods
- Private Static Methods
Informações
- Descrição
- FlashCards sobre Interface, criado por BLU BLU em 27-01-2025.
- Criado por
- BLU BLU
- Visualizações
- 0
- Avaliação