ABSTRACT CLASS AND ABSTRACT METHOD IN JAVA
What is abstraction in java?
Showing only essential parts and hiding the implementation part. This is called abstraction.This can be achieved by java programming.
Ex:-- while download android application in playstore we get only .exe file.when running this exe file the software will work but we cannot see the implementation part.This type of application can be done by java programming,this technique is called abstraction or data hiding
Abstract class and abstract method
abstract class and abstract method in java with example
We know that abstraction is a pillar of the oops concepts,and abstraction is showing only essential parts and hiding implementation details.The class contains variables, methods and constructors.So if any class consists of at least one abstract method then the class will be called an abstract class. The abstract class and abstract method is created using the abstract keyword.An abstract class cannot create objects.If any class consists of only the declaration of a method and hiding the implementation part is called abstract method.The class contains the complete implementation of all the method,that class will called as a concrete class. There will be no abstract methods in concrete class.
Characteristics of abstract method
* only declaration but no definition.
* Implementation written in sub class
Characteristics of abstract class
* contains at least one abstract method
* also contain normal method
* object cannot be created
Characteristics of concrete class
* It should contains complete definition for all the method
* object can be created
Comments
Post a Comment