wsyy
asked on
java String array
Hi,
I have the following code:
Outlink[] otherOutLinks;
otherOutLinks = new Outlink[0];
otherOutLinks[0]=new Outlink(link, "Next");
Why does the third line cause an exception?
Exception in thread "main" java.lang.ArrayIndexOutOfB oundsExcep tion: 0
How can I fix it?
Thanks
I have the following code:
Outlink[] otherOutLinks;
otherOutLinks = new Outlink[0];
otherOutLinks[0]=new Outlink(link, "Next");
Why does the third line cause an exception?
Exception in thread "main" java.lang.ArrayIndexOutOfB
How can I fix it?
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Outlink[] otherOutLinks;
otherOutLinks = new Outlink[1];
otherOutLinks[0]=new Outlink(link, "Next");