package notice;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class NoticeText {
public static void main(String[] args) {
Notice notice1 =new Notice(1,"欢迎来到慕课网!","管理员",new Date());
Notice notice2 =new Notice(2,"请同学们按时提交作业!","老师",new Date());
Notice notice3 =new Notice(3,"考勤通知!","老师",new Date());
List noticeList =new ArrayList();
noticeList.add(notice1);
noticeList.add(notice2);
noticeList.add(notice3);
System.out.println("***********即将开始显示公告内容**************");
for(int i = 0;i<noticeList.size(); i++){
String sout=(i+1)+":"+ ((Notice)(noticeList.get(i))).getTitle();
System.out.println(sout);
}
}
}
我这里改为List并导包之后也并没有报错这是为什么?
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星