how to fix java.lang.IndexOutOfBoundsException

Exception in thread “main” java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:604)

in line of arraylist.java

private void rangeCheck(int index) {
    if (index >= size)
        throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
}

in line

List lstpp = getResult(pp) ;
    System.out.println("=====Persegi Panjang====");
    System.out.println("luas = "+((Integer)lstpp.get(0)));

Please help

Leave a Comment