Abstract class:

--> Any class which has partial implementation is called Abstract class. --> Any class that is having zero or more number of abstract methods can be made as abstract class. Abstract class can contain below things: 1. Variables(Instance & Static) 2. Constants. 3. Constructors. 4. Functions with body. 5. Functions without body(Abstract method). 6.Static members. Note: It is mandatory to use "abstract" keyword, if you are not giving body to the function. 1.If your class is having atleast one abstract method then it is mandatory that you have to make that class as abstract class else compiler will give error. 2.If your class in not having any abstract method then it is not mandatory to make that class as abstract class. But if you want to make we can make that class as abstract class also.

Properties of Abstract Class:

1.You cannot create objects for the abstract classes. abstratclass
                abstract class Shape
	        {
   	                private int x, y, color;
   	                public Shape(int x, int y, int clr)
                        {
                               this. x = x;
                               this. y = y;
                               color = clr;
                         }
                         public void moveTo(int s, int t)
                         {
                            x= s;
                            y= t;
                         }
                         public void setColor(int clr)
                         {
                            color = clr;
                         }
                         public abstract void findArea();
                         public abstract void drawShape();
                   }

                    class Rect extends Shape
                    {
                             int len,bred;
                             public Rect(int x, int y, int color, int l, int b)
                             {
                                super(x,y,color);
                                len = l;
                                bred = b;
                             }
                     public void findArea()
                     {
                                 System.out.println(len*bred);
                       }
                   }
2. Abstract class can only be extended. 3. Abstract interfaces can be implemented. /* public void drawShape() { System.out.println("drawing Rect"); */ if this is not then add abstract for class. } --> If you are extending any abstract class then you have to implement all the abstract method of that abstract class, else it will give compile time error. --> If you cannot implement all the abstract methods then you have to make your class abstract class to suppress compile time errors. abstratclass1.PNG
If you do not want anyone to create object for your class even though all the function are defined this can be achieved in two ways. 1.By making your class as "abstract class". 2.By using "private" constructors. For abstract methods we should not give "private" as the access modifier. abstratclass2
In the above example Framework activity class cannot implement statup() and shutdown() function because it does not know what all the variables initialized in the application layer class. But it knows how to handle "UI" events. That's why this class is made as abstract class.