More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
This question was recently asked at 'Oracle financial services'.This question is still unanswered. Can you please provide an answer.
Help us improve. Please let us know the company, where you were asked this question :
LikeDiscussCorrect / Improve  interface vs abstraction  interfacing vs abstraction  relation between interface and abstraction  How interface provide abstraction Asked in 1 Companies
Ans. Base Class is a relative term used to signify the Parent class in Parent - Child or Base - derived relationship.
Derived Class is a relative term used to signify the Child class in Parent - Child or Base - derived relationship.
Abstract Class is a class that is not allowed to be instantiated and hence can serve only a base class for it's usage.
Concrete Class is the class which is supposed to be instantiated and hence provide definition for all implementing interface methods and extending abstract methods.
Help us improve. Please let us know the company, where you were asked this question :
Q10. What are the advantage of Abstract classes over interfaces with respect to Java 7 ? and What changed in Java 8 to help facilitate that in Java 8 ?
Ans. Abstract Classes provide default implementations of methods that are inherited by the classes that extend them, which was not the case for Interfaces. This changed in Java 8, where default implementations are provided for methods.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Such a class still can have member elements which can be inherited and hence facilitate code reuse. Moreover Abstract class can have non final static elements whereas interfaces are only allowed to have static final elements.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Abstract classes provide a mechanism of interfacing ( using abstract method ) as well as code reuse through inheritance ( extending abstract class )
Comparing to concrete class they have an advantage of providing interface which a concrete class doesn't provide.
Comparing to interfaces they have an advantage of providing code reuse through inheritance which interfaces dont provide.
Ans. The objective of an abstract class is to provide an interface as well as code reuse. Though we cannot instantiate an instance of abstract class but we can reuse the code by extending such a class. Moreover abstract class provides interfacing to outside components just like interfaces.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Yes, but in that case the derived class itself should be abstract. We cannot have an object of a class without definition for the method which has been declared abstract in the parent.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Abstract methods are the methods that need to be overridden in the derived class ( either as implementing method or again abstract method ) so it's not only allowed but its required to override abstract method in the derived class.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Abstract classes provide a mechanism of interfacing ( using abstract method ) as well as inheritance ( extending abstract class ). So they should be used in place of interfaces in case there is some code ( methods ) or object body ( member elements ) that can be reused with inheritance.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Car Engine is an example of encapsulation and abstraction. You ignite the car using an interface called starter and least bothered about how the tire actually moves (This is abstraction). The engine encapsulates the complete process to itself only and doesn't allow you to start the other components like the radiator etc ( this is excapsulation )
Help us improve. Please let us know the company, where you were asked this question :
Ans. 1.Abstraction solves the problem at design level while encapsulation solves the problem at implementation level
2.Abstraction is used for hiding the unwanted data and giving relevant data. while Encapsulation means hiding the code and data into a single unit to protect the data from outside world.
3. Abstraction lets you focus on what the object does instead of how it does it while Encapsulation means hiding the internal details or mechanics of how an object does something.
4.For example: Outer Look of a Television, like it has a display screen and channel buttons to change channel it explains Abstraction but Inner Implementation detail of a Television how CRT and Display Screen are connect with each other using different circuits , it explains Encapsulation.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Factory Pattern deals with creation of objects delegated to a separate factory class whereas Abstract Factory patterns works around a super-factory which creates other factories.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Keep it as a Abstract Class if its a "Is a" Relationsship and should do subset/all of the functionality. Keep it as Interface if its a "Should Do" relationship.
Help us improve. Please let us know the company, where you were asked this question :