zoukankan      html  css  js  c++  java
  • Java文档注释

     1 import java.io.*;
     2  
     3 /**
     4 * 这个类演示了文档注释
     5 * @author Mort
     6 * @version 1.2
     7 */
     8 public class SquareNum {
     9    /**
    10    * This method returns the square of num.
    11    * This is a multiline description. You can use
    12    * as many lines as you like.
    13    * @param num The value to be squared.
    14    * @return num squared.
    15    */
    16    public double square(double num) {
    17       return num * num;
    18    }
    19    /**
    20    * This method inputs a number from the user.
    21    * @return The value input as a double.
    22    * @exception IOException On input error.
    23    * @see IOException
    24    */
    25    public double getNumber() throws IOException {
    26       InputStreamReader isr = new InputStreamReader(System.in);
    27       BufferedReader inData = new BufferedReader(isr);
    28       String str;
    29       str = inData.readLine();
    30       return (new Double(str)).doubleValue();
    31    }
    32    /**
    33    * This method demonstrates square().
    34    * @param args Unused.
    35    * @return Nothing.
    36    * @exception IOException On input error.
    37    * @see IOException
    38    */
    39    public static void main(String args[]) throws IOException
    40    {
    41       SquareNum ob = new SquareNum();
    42       double val;
    43       System.out.println("Enter value to be squared: ");
    44       val = ob.getNumber();
    45       val = ob.square(val);
    46       System.out.println("Squared value is " + val);
    47    }
    48 }

     

  • 相关阅读:
    弹飞绵羊
    POJ 3308
    狼抓兔子
    块状链表题*1
    块状链表
    双向链表
    Linux入职基础-1.2_U盘安装RedHat5具体步骤
    Linux入职基础-1.1_国内开源的主要镜像站
    VS.NET(C#)--2.9_HTML服务器控件案例
    VS2015按钮方法
  • 原文地址:https://www.cnblogs.com/MWCloud/p/11161650.html
Copyright © 2011-2022 走看看