Menu
Question Index
...

What will be the output of the following program?

abstract class Shape
{
    int b = 20;
    public void display()
    {
        System.out.println("This is display method");
        System.out.println(b);
    }
    abstract public void calculateArea();
}
class Rectangle extends Shape
{
    public static void main(String args[])
    {
        Rectangle obj = new Rectangle();
        obj.b = 200;
        obj.display();
    }
       public void calculateArea() {    }
}


This is display method
20
This is display method
200
20
Compilation Error or Runtime Error

Doubts

Problems

Topic: Abstract Method In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App