Javadoc 注释书写规范

package com.datastructure.one;
/**
 *	The TemperatureConversion Java applicatoin prints a table
 *	converting Celsius to Fahrenheit degress.
 * @author zhangzhaoyu
 * <a href="mailto:[email protected]>">[email protected]</a>
 */
public class TemperatureConversion {

	
	public static void main(String[] args) {
		
		final double TABLE_BEGIN = -50.0;
		final double TABLE_END = 50.0;
		final double TABLE_STEP = 10.0;
		
		double celsius;
		double fahrenheit;
		
		System.out.println("TEMPERATURE CONVERSION");
		System.out.println("----------------------");
		System.out.println("Celsius     Fahrenheit");
		for (celsius = TABLE_BEGIN; celsius < TABLE_END; celsius += TABLE_STEP ) {
			fahrenheit = celsiusToFahrenheit(celsius);
			System.out.printf("%6.2fC", celsius);
			System.out.printf("%1.4fF\n", fahrenheit);
		}
		System.out.println("----------------------");
		
		
	}
	/**
	 * Convert a temperature from Celius to Fahrenheit.
	 * @param c
	 * 	a temperature in Celsius degress
	 * @precondition
	 * 	c >= -273.15
	 * @return
	 * 	the temperature c converted to Fahrenheit
	 * @postcondition
	 * 	The Fahrenheit temperature equivalent to c has been
	 * 	printed to System.out
	 * @throws IllegalArgumentException
	 * 	Indicates that c is less than the smallest Celsius
	 * 	temperature(-273.15)
	 */
	public static double celsiusToFahrenheit(double c) {
		
		final double MINIMUM_CELSIUS = -273.15;
		if (c < MINIMUM_CELSIUS) {
			throw new IllegalArgumentException("Argument " + c + " is too small.");
		}
		return (9.0/5.0)*c + 32;
	}

}

你可能感兴趣的:(java)