Go Back   SitePoint Forums > Forum Index > Program Your Site > Java and JSP
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Nov 6, 2009, 04:54   #1
dimis283
SitePoint Evangelist
 
Join Date: Mar 2006
Posts: 581
java.lang.ArrayIndexOutOfBoundsException problem

I am dotin this
Code:
String[] filesToZip ={ args[0]};
but I have this error
Quote:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
what is wrong
dimis283 is offline   Reply With Quote
Old Nov 6, 2009, 05:27   #2
dimis283
SitePoint Evangelist
 
Join Date: Mar 2006
Posts: 581
I solve it!
dimis283 is offline   Reply With Quote
Old Nov 7, 2009, 09:02   #3
ge0man
SitePoint Member
 
Join Date: Oct 2009
Posts: 14
This is for anyone else that might get this problem since OP didn;t state what they did to fix it.

Most of the time this error happens when you try to access a spot in the array that wasn't either initialzed or doesn't exist.. for instance.

int [] numberArray = {1,2,3};

the size of the Array is 3...

if you try this: numberArray[3] you will get the above error because you tried to access a spot that was not initialized since there size is 3 and not 4..

this would work:

numberArray[2] which would have the value of 3
ge0man is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 11:43.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved