
Using arraylist class , what type of exception are throws, how can write a java programe

An ArrayList can throw ArrayIndexOutOfBoundsException. Here is a example.
import java.util.*;
public class ArraylistException {
void buildAlphabet() {
ArrayList list = new ArrayList();
for (int i =1; i <=5; i++)
{
list.add(i,(String)("Girish"));
}
System.out.print("Elements of array are: " + list);
}
public static void main(String[] args) {
ArraylistException ale=new ArraylistException();
ale.buildAlphabet();
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.