import java.util.*;
/**
* collection 与iterator接口
*
*
**/
public class testcollection
{
   public static void main(string args[])
   {
     arraylist v = new arraylist();
     int b = 0;
     system.out.println(“please input the number:”);
     while(true)
     {
     try
     {
       b = system.in.read();
     }
     catch(exception e)
     {
         e.printstacktrace();
     }
     if(b==\r || b==\n)
     {
       break;
     }
     else
     {
       int num = b -0;
       v.add(new integer(num));
     }
     }
     int sum = 0;
     iterator e = v.iterator();
     while(e.hasnext())
     {
       integer intobj = (integer)e.next();
       sum += intobj.intvalue();
     }
     system.out.println(sum);     }
}
Collection 与iterator接口-JSP教程,Java技巧及代码
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Collection 与iterator接口-JSP教程,Java技巧及代码
相关推荐
-      J2ME中的时间处理方法
-      J2ME播放声音流程简介
-      J2ME开发之手机键盘使用注意问题
-      J2ME 记录管理存储
-      MVC模式在j2me项目中的应用(二)
-      MVC模式在j2me项目中的应用(一)
-      J2ME中使用记录存储系统(RMS)存储信息
-      J2ME与MIDP开发(1)
