数组的增删改查
public class MyArray {
private long[] arr;
//表示有效数据的长度
private int elements;
public MyArray(){
arr = new long[50];
}
public MyArray(int maxsize){
arr = new long[maxsize];
}
/**
* 添加数据
*/
public void insert(long value){
arr[elements] = value;
elements++;
}
/**
* 显示数据
*/
public void display(){
System.out.print("[");
for(int i=0;i
关注
打赏