⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 circletest2.java

📁 《Java面向对象程序设计》例子源代码.轻松学习书本.
💻 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 + -