r/javahelp • u/Charlemagne-767 • Mar 05 '23
Solved Implementing a method within a toString method
I'm writing a class in which I have a class representing a circle. With the radius, two public methods were created to calculate the area and perimeter respectively. How might I call these methods in the toString method of the class? I have attached some of the class for visual representation.
Note: There is no good reason for you to down vote my posts.
0
Upvotes
4
u/desrtfx Out of Coffee error - System halted Mar 05 '23
Since you haven't in the faintest mentioned what your actual
toStringmethod should output, we cannot directly help.Also, neither the
area, nor theperimetermethod should bestaticand even less take an argument. The radius is already part of theCircleobject and this is the radius that should be used for the calculations.What I would imagine is that you will want some string concatenation to integrate the calculated perimeter and area in the output.