为了账号安全,请及时绑定邮箱和手机立即绑定

关于使用eclipse的疑问:快捷键运行f11和按钮(Run****(already run))有什么区别

关于使用eclipse的疑问:快捷键运行f11和按钮(Run****(already run))有什么区别

溯源1 2017-10-22 23:24:30
package storecrime;import java.util.ArrayList;import java.util.Arrays;import java.util.Iterator;import java.util.List;public class CrimeTest { public List CrimenameToSelect; public CrimeTest() { this.CrimenameToSelect=new ArrayList(); }public void CrimenameAdd() { crimename cn1=new crimename("乱扔垃圾","001",2); CrimenameToSelect.add(cn1); System.out.println("录入了罪名:"+cn1.rank+"级"+cn1.ID+""+cn1.name); crimename cn2=new crimename("偷看室友洗澡","002",3); CrimenameToSelect.add(cn2); System.out.println("录入了罪名:"+cn2.rank+"级"+cn2.ID+""+cn2.name); //System.out.println("测试:"+((crimename)CrimenameToSelect.get(1)).name); crimename[] crimename2= {new crimename("考查课作弊","003",1),new crimename("考试课作弊","004",5)}; CrimenameToSelect.addAll(0,Arrays.asList(crimename2)); crimename temp1=(crimename)CrimenameToSelect.get(2); crimename temp2=(crimename)CrimenameToSelect.get(3); //System.out.println("录入了两项罪名:"); System.out.println(((crimename)CrimenameToSelect.get(3)).name); System.out.println("录入了两项罪名:"+temp1.rank+"级"+temp1.ID+""+temp1.name+""+temp2.rank+"级"+temp2.ID+""+temp2.name); } public void testGet() { int size=CrimenameToSelect.size(); System.out.println("存入以下罪刑:"); for(int i=0;i<size;i++) { crimename cr=(crimename)CrimenameToSelect.get(i); System.out.println("罪刑:"+cr.ID+":"+cr.name); } } public void testIterator() { Iterator it=CrimenameToSelect.iterator(); System.out.println("已存入以下罪刑(Iterator):"); while(it.hasNext()) { crimename cr3=(crimename)it.next(); System.out.println("罪刑:"+cr3.ID+":"+cr3.name); } } public void testModify() { CrimenameToSelect.set(1,new crimename("上课玩手机","003",5)); } public static void main(String[] args) { // TODO Auto-generated method stub CrimeTest ct1=new CrimeTest(); ct1.CrimenameAdd(); ct1.testIterator(); ct1.testModify(); ct1.testGet(); }}//***********************************************************************package storecrime;public class crimename { String name; String ID; int rank; public crimename(String name,String ID,int rank){ this.ID=ID; this.name=name; this.rank=rank; }}//***********************************************************************package collect;public class Course { public String id; public String name; public Course (String id,String name) { this.name=name; this.id=id; }}
查看完整描述

目前暂无任何回答

  • 0 回答
  • 1 关注
  • 2669 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信