OOP IN JAVA - ( "abstract" KEYWORD)
ABSTRACTION
As Java is an OOP language, abstraction can be seen as one of the important features and building blocks of the Java language. In Java, abstraction is implemented using an abstract class and interface and another explanation "is a process of hiding the implementation details and showing only functionality to the user."
first of all I would to explain :
What is abstract class ?
An abstract class can be defined as a class declared with the keyword “abstract” and has a restriction that it cannot be instantiated.
and especial thing is the following are the properties of the java abstract method,
- can only be used in an abstract class, and it does not have a body.
- An abstract method contains a method signature, but no method body.
- An abstract method is a method that is declared without implementation.
- Instead of curly braces, an abstract method will have a semicolon (;) at the end.
Why use abstraction Class :
- keep it the Meaningless method
- Because abstract method can be kept only in abstract class.
- Because sub classes need to use super keyword and run the method.
THANK YOU!
Comments
Post a Comment