This is one of the frequently asked interview question. No, We cannot have a Constructor defined in an Interface. A method in a interface will be public and abstract by default to provide 100% abstraction and the implementation(method body) will be provided by the implementing class.In this article we will get to know why Constructors are not allowed in Interface. [Read more…]
Abstraction is a process of hiding the implementation details and showing only functionality to the user. Earlier we have learnt about abstract class in java which is used to achieve partial abstraction. In this tutorial we will discuss about interfaces which are used for achieving full abstraction. [Read more…]
This is one of the most frequently asked question in the interview. Many interviewers will not leave this topic. So lets see the difference between them
- The main difference is that the Interfaces are implicitly abstract and cannot have implementation, whereas the abstract class can have the concrete class.
- Interface are implemented using the “implements” keyword. Abstract class can be extended using the “extends” keyword. [Read more…]