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

📄 hasxy.java

📁 程序练习中包括书中实例程序代码和练习中要用到的代码,是压缩文件
💻 JAVA
字号:
package examples.inheritance;

/** An example Java subclass used to demonstrate
  * inheritance concepts
  */
public class HasXY extends HasX {

   private int y;

   /** Method to set the object's value
     * @param inputY The field's new value
     */
   public void setY( int inputY ) {
      y = inputY;
   }

   /** Method to get the object's value
     * @return The value of the field
     */
   public int getY() {
      return y;
   }

   /** Method to write Y to <code>System.out</code>
     */
   public void showY() {
      System.out.println( y );
   }

   /** The test method for the class
     * @param args not used
     */
   public static void main( String[] args ) {
      HasXY obj = new HasXY();   
      obj.setY( 20 );
      obj.setX( 10 );
      obj.showY();
      obj.showX();
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -