Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

5. Who should facilitate the focus group?

Answered: 1 week ago

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago