![]() Below is the difference between interface and abstract class in java 1. We can declare any number of default, static and abstract methods inside interface.Īn interface can have one or more default methods and still be functional, if has only one abstract method.Īfter having default and static methods inside the interface, one may think about the need of abstract class in Java. From java 1.8 we can declare static method inside interface, when we declare a static concrete method inside interface we should not make it default. From java 1.8, “default” is a new keyword and it shouldn’t be used for identifiers. Only the difference is that when we write the concrete methods in interface, it should be defined with new non-access specifier “default” and such methods are called as default methods. Before java 1.8, interface can have only abstract methods, from java 1.8 interfaces can also have both concrete and abstract methods. Thit k interface luôn là mt công vic rt khó khn, bi vì khi chúng ta thay i các phng thc bên trong interface nó òi hi.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |