Question: what is the expected output from this code: public class CircleDemo { public static void main ( String [ ] args ) { Circle circle

what is the expected output from this code:

public class CircleDemo {

public static void main ( String [ ] args ) {

Circle circle = new Circle ( 24.5 ) ;

getObject( circle ) ;

}

public static void getObject ( Circle c ) {

System.out.println( "The radius of circle: " + c.radius ) ;

System.out.println( "The area of circle: " + c.getArea( ) ) ;

}

}

public class Circle {

private double radius ;

public Circle ( double r ) { radius = r ; }

public void setRadius ( String r ) { radius = Double.parseDouble ( r ) ; }

public double getRadius ( ) { return radius ; }

public double getArea ( ) { return 3.14 * radius * radius ; }

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!