package sort;class ArrayBub {    private long[] a;
    private int nElems;    public ArrayBub(int max) {
        a = new long[max];
        nElems = 0;
    }    public void insert(long value) {
        a[nElems] = value;
        nElems++;
    }    public void display() {
        for (int j = 0; j < nElems; j++) {
            System.out.print(a[j] + " ");
        }
        System.out.println("");
    }    public void selectSort() {
        int out, in, min;
        for (out = 0; out < nElems - 1; out++) {
            min = out;
            for (in = out + 1; in < nElems; in++) {
                if (a[min] > a[in]) {
                    min = in;
                }
            }
           swap(out, min);
        }    }    private void swap(int one, int two) {
        {
            long temp = a[one];
            a[one] = a[two];
            a[two] = temp;
        }
    }
}public class selectionSort {    public static void main(String[] args) {
        int maxSize = 100;
        ArrayBub arr;
        arr = new ArrayBub(maxSize);        arr.insert(77);
        arr.insert(99);
        arr.insert(44);
        arr.insert(55);
        arr.insert(22);
        arr.insert(88);
        arr.insert(11);
        arr.insert(66);
        arr.insert(00);
        arr.insert(33);        arr.display();        arr.selectSort();
        arr.display();    }
}运行报这个错
Exception in thread "main" java.lang.VerifyError: (class: sort/ArrayBub, method: <init> signature: (I)V) Constructor must call super() or this()
        at sort.selectionSort.main(selectionSort.java:53)
Java Result: 1当把maxSize 改成20就不报错,但是eclipse不报错,大家来看看

解决方案 »

  1.   

    在我的eclipse 下面运行也没问题
    应该是 netbean 的问题吧 
      

  2.   

    netbeans总是报arr = new ArrayBub(maxSize);这个位置错误不解呀,在CMD下页不报错。难道是内置的一种安全机制?
      

  3.   

    http://zzg810314.javaeye.com/blog/180232
      

  4.   

    今天在tomcat4下跑一个工程,结果到tomcat5下就不能运行了,报java.lang.VerifyError,查了一下javaAPI,是这样解析的 
    当“校验器”检测到一个类文件虽然格式正确,但包含着一些内部不一致性或安全性问题时,抛出该错误但是怎么解决呢???????????
      

  5.   

    竟然还 arr.selectSort();这错误,Netbeans疯掉了,看来
      

  6.   

    jar 文件冲突
    tomcat5的Tomcat5.0\common\endorsed目录下xercesImpl.jar跟WEB-INF\lib目录下的xerces.jar冲突了 http://zzg810314.javaeye.com/blog/180232
    这上面不是说了嘛 
      

  7.   

    我没用Tomcat5.0,?和Tomcat5.0没关系吧