sum类的编写(Java语言)

作者在 2010-04-06 21:04:16 发布以下内容
package IIOPRMI;

/**
*
@author Administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class sum {
    public static void main(String[] args)
    {  
    int summ =0;
    if(args.length > 0) {
       for (int j=0; j < args.length; j++) {
          summ = summ +  Integer.parseInt( args[j]);
      }
    }
    System.out.println("sum is :" + summ);
    }

}
package IIOPRMI;
/**
 * @author Administrator
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class sum {
 public static void main(String[] args)
 {  
 int summ =0;
 if(args.length > 0) {
    for (int j=0; j < args.length; j++) {
       summ = summ +  Integer.parseInt( args[j]);
   }
 }
 System.out.println("sum is :" + summ);
 }
}
默认分类 | 阅读 694 次
文章评论,共0条
游客请输入验证码
文章分类
文章归档
最新评论