Abstract Class in Java

An abstract class is a class marked with the abstract keyword. It, contrary to non-abstract class, may contain abstract - implementation-less - methods. It is, however, valid to create an abstract class without abstract methods.

An abstract class cannot be instantiated. It can be sub-classed (extended) as long as the sub-class is either also abstract, or implements all methods marked as abstract by super classes.

Abstraction can be achieved with either abstract classes or interfaces .

  • Abstract class must have one abstract method.
  • We can’ts create object using abstract class.
  • Abstract class can have abstract and non abstract methods.

Source Code

//Abstract Class in Java Programming
abstract class Shape
    abstract void draw();
    void message()
        System.out.println("Message From Shape");
class rectangleShape extends Shape
    void draw() {
        System.out.println("Draw Rectangle Using Length & Breadth..");
public class abstractDemo {
    public static void main(String args[]) {
        rectangleShape o =new rectangleShape();


Draw Rectangle Using Length & Breadth..
Message From Shape
To download raw file Click Here

Basic Programs