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);
}