1import java.util.Scanner;
2public class AreaOfCircle {
3 public static void main(String args[]){
4 int radius;
5 double area;
6 Scanner sc = new Scanner(System.in);
7 System.out.println("Enter the radius of the circle ::");
8 radius = sc.nextInt();
9 area = (radius*radius)*Math.PI;
10 System.out.println("Area of the circle is ::"+area);
11 }
12}
1public class scratch {
2 public static void main(String[] args) {
3 JFrame window = new JFrame();
4 window.setTitle("Christmas Tree");
5 window.setSize(700, 600);
6 window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
7 window.setVisible(true);
8 DrawingComponent DC = new DrawingComponent();
9 window.add(DC);
10 }
11}
12class DrawingComponent extends JComponent{
13 public void paint(Graphics graph0){
14 Graphics2D graph = (Graphics2D) graph0;
15 Ellipse2D.Double circle = new Ellipse.Double(5, 5, 25, 25);
16 graph.fill(circle);
17 }
18}