📄 circletest2.java
字号:
//CircleTest2.java
import java.text.DecimalFormat;
import javax.swing.JOptionPane;
public class CircleTest2 {
public static void main( String[] args ) {
Circle2 circle = new Circle2( 37, 43, 2.5 );
//使用继承自Point2的方法getX和getY
String output = "X coordinate is " + circle.getX() +
"\nY coordinate is " + circle.getY() +
"\nRadius is " + circle.getRadius();
circle.setX( 35 ); //使用继承自Point2的方法setX
circle.setY( 20 ); //使用继承自Point2的方法setY
circle.setRadius( 4.25 );
output += "\n\nThe new location and radius of circle are\n" +
circle.toString();
DecimalFormat twoDigits = new DecimalFormat( "0.00" );
output += "\nDiameter is " +
twoDigits.format( circle.getDiameter() );
output += "\nCircumference is " +
twoDigits.format( circle.getCircumference() );
output += "\nArea is " + twoDigits.format( circle.getArea() );
JOptionPane.showMessageDialog( null, output );
System.exit( 0 );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -