Why abstract class cant be instantiated ?

Discussion in 'Object Oriented Concepts' started by saurabh4career, Sep 22, 2009.

  1. saurabh4career

    saurabh4career New Member

    Hello Friends.......

    I want know why we can not make an object of Abstract class??

    Thanks in advance...
  2. pawan_mangal

    pawan_mangal New Member

    abstract class is not fully class means some method in abstract class dont have body. Eg. Honda car is a type of Vehicle. and vehicle have some common method like registration of specific vehicle.and every car has own registration no. so vehicle is a abstract class(it can not be physically exist) and hond car(exist physically) is a subclass of vehicle.
  3. saurabh4career

    saurabh4career New Member

    is it ok to give this type of answer in interview?????
  4. vbraojava

    vbraojava New Member

    Hi Saurabh

    An Abstract class is a class that is declared as abstract. It may or may not include abstract methods.

    We must declare Abstract class and Abstract methods with the key word abstract.

    Abstract classes cannot be instantiated, means we can't create an object to Abstract class. We can create Subclasses to Abstract classes.

    An Abstract class may or may not have abstract methods, abstract method in the sense a method can declared without any body implementation is called abstract method. So in that case JVM does not know how much memory it has to allocate for that abstract method because abstract method does not have body implementation. So JVM will not able to allocate memory for the abstract methods when the time of creating instance to Abstract class. So JVM unable to create the instance to Abstract class. So that we can't create the object for the Abstract class.

    It is also possible that we can create an Abstract class with all concrete methods, that is without any abstract methods also. In that case also we can't create the instance for the Abstract class. Why because the abstract keyword simply indicates to JVM that the class cannot be instantiated.

    The designers of Java made the JVM that when it find abstract keyword for any class then JVM can't create the instance for that class.
  5. anneroberts

    anneroberts Member

    Theoretical classes can't a chance to be instantiated, methods we can't make an protest unique class. We camwood make Subclasses should theoretical classes. A conceptual class might alternately might not need unique methods, unique system in the feeling a technique might announced without At whatever muscle to execution is known as theoretical technique.

Share This Page