import java.util.ArrayList; public class Notepad {  public String item;  public ArrayList list;  public Notepad() {   list=new ArrayList();   this.item=null;  }  public Notepad(String item){   list=new ArrayList();   list.add(item);   this.item=item;  }   public void add(String item) {   list.add(item);  };  public void check() {   System.out.println(list);  };  public void check(int index) {   if(index>getcount()) {System.out.println("超出记录范围");}   else System.out.println(index+"位置处的记录是:"+list.get(index));}  public int getcount() {   return list.size();  }  public void dele(String item) {list.remove(item);};  public static void main(String [] args) {   Notepad note=new Notepad("hello");   note.add("hi");   int cc=note.getcount();   System.out.println(cc);   note.check();   note.dele("hi");   note.add("I am");   note.add("Lemon");   note.check();   note.check(2);   note.check(10);  }
点赞 评论

相关推荐

酷酷的喜马拉雅山:感觉这比一直在初筛不动的好多了
点赞 评论 收藏
分享
09-01 11:31
门头沟学院 Java
buul:七牛云的吧,感觉想法是好的,但是大家没那么多时间弄他这个啊。。。不知道的还以为他是顶尖大厂呢还搞比赛抢hc,只能说应试者的痛苦考察方是无法理解的,他们只会想一出是一出
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务