JAVA小程序的注释

来源:百度知道 编辑:UC知道 时间:2024/05/17 23:47:55
package jac;
import java.math.BigInteger;

/**
* @author gaofeng
*/
public class TestFactorial
{
public static void main(String[] args)
{
BigInteger result = new BigInteger(""+1);
for(int i=1; i<=1000; i++)
{
result = result.multiply(new BigInteger( "" + i ));
}
System.out.println(result);
}
}

package jac;
import java.math.BigInteger;

/**
* @author gaofeng
*/
public class TestFactorial
{
public static void main(String[] args)
{
BigInteger result = new BigInteger(""+1); //创建一个BIGINTEGER对象 RESULT此时的值为1
for(int i=1; i<=1000; i++)
{
result = result.multiply(new BigInteger( "" + i )); //这里的方法与result=result+i;同意
}
System.out.println(result);//结果为1+1+2+3+4……+1000的值
}
}

我想(/**注释语句*/那是生成文档注释的一种方式吧.反正是不太明白你的意思.@author是javaDoc标记.指定作者
还有就是不生成文档注释的就是用//(注释掉它之后的和它同行的语句)或是/*注释语句*/(在这之间的都将被注释掉).

package jsptest;

import java.math.BigInteger;

/**
* @author gaofeng
*/
class TestFactorial
{
public static void main(String[] args)
{
BigInteger result = new BigInteger(""+1); //实例化BigInteger 应该把“”+1去掉
for(int i=1; i<=1000; i++) //循环1000次(相加)
{
result = result.mult