P. Mangs P. Mangs - 11 months ago 53
Java Question

How to print a static method in java that takes an int as parameter and returns a double

I'm having difficulty trying to print the result of the static method calcArea, which takes the int radius as parameter to calculate the area of a circle and returns the area.

Here's the code below

Answer Source

The function calcArea() takes the value of radius and then returns area. To do this, you need to pass an argument to calcArea(). So, your code should be like this:

    System.out.print("The area of the circle is:" + calcArea(radius));

The error you're getting clearly points out that you're missing an argument.