I'm not sure if it's the only problem, but one problem is that you're calling s.next() twice each time round the loop. Each call to next() moves on to the next token, but that isn't what you want here. Change the print line to System.out.println(a[i]) and you'll avoid that.
If there's still a problem after that, it's much more useful if you tell us what line the exception is thrown on.
Actually the file contains 5200 names with comma seperated . my aim is to seperate each name and store it in a array.
I use system.println to see how the seperator works , if i not using the string array all 5200 names are printed , if try to transfer to array and exception is thrown.
Joined: Oct 01, 2011
Hi Matthew Brown ,
Yes , you were correct . When i removed the s.Next(). it resolved the issue , twice i was calling . Cool thanks a lot.
That is the diffrence between an experienced programmer and begginer. Thanks for your time.
my final code is , this is to solve the problem 22 of project euler. it took 198 ms to execute ( too long ) i need to learn a lot. using methods and reusing of codes I have to learn.
is there any book that will help me?