Menu
Question Index
...

What will be the output of the following program?

public class CalculateAreas {
    public static void main(String arg[]) {
        Circle circle = new Circle();
        circle.radius = 7.5;
        System.out.println("Area of circle is " + circle.getArea());
    }
}
abstract class Shape {
    abstract double getArea();
}
class Circle extends Shape {
    double radius;
    @Override
    double getArea() {
        return 3.14 * radius * radius;
    }
}


Area of circle is
Area of circle is 176.625
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