Sir see->
public static void main(String[] args)
{
List<String>c=new ArrayList<String>();
c.add("123");
System.out.println(c);
System.out.println(c.get(1)); //Gives IndexOutOfBoundsException.
System.out.println(c.get(-1)); //Gives ArrayIndexOutOfBoundsException.
}
If going to negative index giving AIOOBoundsException but if going to Positive index then giving IndexOutOfBoundsException. Why??
Arraylist
Moderator: admin
-
- Site Admin
- Posts: 10061
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: Arraylist
Answered here already: https://coderanch.com/t/683065/certific ... sException
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: Bing [Bot], gadsgadsx and 107 guests