You are on page 1of 2

Roll no.


\*Define a class Circle having data members pi and radius Initialize and display values of data members also calculate area of circle and display it. *\
class Circle { float radius; double pi=3.14; Circle(float x) { radius=x; } void display() { double area; System.out.println("radius of circle is : "+radius); System.out.println("pi of circle is : "+pi); area =pi*radius*radius; System.out.println("area of circle is : "+area); } } class CirArea { public static void main(String args[]) { Circle c1= new Circle(6); c1.display(); } }