Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- abstract class Shape {
- public abstract double area();
- }
- class Circle extends Shape {
- private double radius;
- public Circle(double radius) {
- this.radius = radius;
- }
- @Override
- public double area() {
- return Math.PI * radius * radius;
- }
- }
- public class Pr2b {
- public static void main(String args[]) {
- Circle c = new Circle(10.0);
- System.out.println("Area of Circle=" + c.area());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement