-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestcir.java
More file actions
40 lines (37 loc) · 736 Bytes
/
testcir.java
File metadata and controls
40 lines (37 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.util.*;
class circle
{
double r=1;
static int c=0;
circle(double r1)
{
r=r1;
c +=1;
}
circle() { c +=1; }
void setr()
{
Scanner sc=new Scanner(System.in);
double r2=sc.nextDouble();
r=r2;
}
double setdata()
{
double ans=(r * r * 3.1428);
return ans;
}
}
public class testcircle
{
public static void main(String args[])
{
circle c1=new circle(20);
System.out.println("c1: "+ c1.setdata());
circle c2=new circle();
System.out.println("c2: "+ c2.setdata());
circle c3=new circle();
c3.setr();
System.out.println("c3: "+ c3.setdata());
System.out.println("no of Obj: "+c3.c);
}
}