Menu
Question Index
...

What will be the output of the following program?

class CalculateAreas
{
    public static void main(String arg[])
    {
        Square sq = new Square(5.25);
        System.out.println("Area of Square is " + sq.getArea());
    }
}

abstract class Shape
{
    abstract double getArea();
}

class Square extends Shape
{
    double side;

    double getArea()
    {
        return side * side;
    }
}


Area of Square is 27.5625
Area of Square is 0
Compilation Error
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