我正在尝试将对象内的一些数据输出到控制台。似乎正在工作,但在数据下方我收到一条奇怪的消息。
下面是代码:
import java.text.DecimalFormat;
/**
* The Circle class calculates area, diameter, and circumference
*/
public class Circle {
DecimalFormat fmt = new DecimalFormat("#0.00");
// Fields
private double radius; // Holds the circle radius
private final double PI = 3.14159; // The formula for PI
/**
* Start Constructors
*/
public Circle(double rad) {
radius = rad;
System.out.println("The circle's radius is " + (fmt.format(radius)));
System.out.println("The circle's area is " + (fmt.format(PI * radius * radius)));
System.out.println("The circle's diameter is " + (fmt.format(radius * 2)));
System.out.println("The circle's circumference is " + (fmt.format(2 * PI * radius)));
}
}
控制台输出为:
The circle's radius is 2.00
The circle's area is 12.57
The circle's diameter is 4.00
The circle's circumference is 12.57
Circle@5115a298
什么是圈子消息?