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
- 
				admin
 - Site Admin
 - Posts: 10443
 - Joined: Fri Sep 10, 2010 9:26 pm
 - Contact:
 
Re: Arraylist
Answered here already: https://coderanch.com/t/683065/certific ... sException
			
			
									
									
						Who is online
Users browsing this forum: Bing [Bot] and 51 guests