![]() ![]() The smartphone also has the same feature just a difference in versions, the hardware used, etc. Hence, they will have the same features just their implementation will be unique, and features will be the same.įor Example, the Samsung Galaxy Phone provides Camera Feature. Now start thinking, both of them are nothing but smartphones. Let us Suppose we have to design an Interface for two mobile brands say Xiaomi and Samsung Galaxy. It is the implementation of those features which makes them unique. Yet what is the factor which makes them different and unique from each other? Have you ever thought about it? ![]() They all have the same features which a smartphone offers such as: -īasic Functionalities are almost the same in every smartphone. You must have seen that today there are thousands of smartphones available on the market. Let us consider a real-life scenario of a smartphone. But through interfaces, we can make infinite classes, each of them can be unique as well as similar at the same time. Through one class we can make infinite no of objects of its type. ![]() Which in turn, is a blueprint of an object. These methods are overridden in subclasses.įrom the above table, you must have known that Interfaces are the blueprint of the class itself. They can only contain the declaration of abstract and static methods. Interfaces don't have a body of their own. Interfaces are implemented in classes using the implements keyword.Ĭlasses have their own body with function definitions. ParameterĪ class is defined as a blueprint of an object.Īn Interface is defined as the blueprint of a class that contains abstract and static methods.Ī class defines an Object's state, attributes, and behavior (Real World Entities).Ĭlasses are Inherited from another class using extends keyword. Java Provides a great tool for this, which is known as an Interface.Īlthough Class and Interfaces look similar, however, they have differences between them. In Java, there are certain situations where the programmer just needs to focus on which object is doing the job and providing desired output. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |