--Abstraction in java-
-process of hiding the implementation details and showing only functionality to the user
-shows only essential things to the user and hides internal details.
-sending sms, type and send messages but dont know internal processing
-focus on what object does instead how it does
--Two ways to achieve abstraction-
-1.Abstract class (0 to 100%)
-2.Interface (100%)
--Abstract class-
-class that declared as abstract.
-have abstract and non-abstract methods
-needs to be extended and implemented.
--imp points about Abstract class-
-cannot be instatiated (Object creation)
-can have constructor and static methods also
-can have final methods, force the subclass not to change the body of the method
--Abstract method-
-abstract type modifier
-sometimes these methods are referred as sub-classer responsibility
-abstract type methodName(parameter_list);
-no method body is present, just have method signature
-abstract class doesn't need to have an abstract method compulsory
-illegal modifier for methods - final-abstract, abstract static, abstract private
-An abstract class can have a data member, abstract method, method body
(non-abstract method), constructor, and even main() method.
eg.-
abstract class Shape
{
abstract void draw();
}
class Rectangle extends Shape
{
void draw()
{
System.out.println("drawing rectangle");
}
}