Abstraction


  1. Which of these is not a correct statement?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Abstract class cannot be directly initiated with new operator, Since abstract class does not contain any definition of implementation it is not possible to create an abstract object.


  1. If a class inheriting an abstract class does not define all of its function then it will be known as?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Any subclass of an abstract class must either implement all of the abstract method in the superclass or be itself declared abstract.



  1. Which of these is not abstract?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Thread


  1. Which of these keywords are used to define an abstract class?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    abstract



  1. What is the output of this program?

    abstract class n
    {
    int K;
    abstract void display();
    }
    class m extends n
    {
    int L;
    void display()
    {
    System.out.println(L);
    }
    }
    public class Abstract_class_Example
    {
    public static void main(String args[])
    {
    m obj = new m();
    obj.L=5;
    obj.display();
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    class n is an abstract class, it contains a abstract function display(), the full implementation of display() method is given in its subclass m, Both the display functions are the same. Prototype of display() is defined in class n and its implementation is given in class m.
    output: 5