Hey everyone,
I have been programming in java for a while now but have never once come across this...
I am opening a text file and reading it into a string variable using
myVar = myVar + inputLine;
I am then splitting it
String[] tData; for(int i =0; i < information.length ; i++){ System.out.println(information[i]); // OUTPUTS: 100-83-42-11-56-38-62-98 tData = information[i].split("-"); List<String> wordList = Arrays.asList(tData); System.out.println(wordList.size()); //This is outputting 8 System.out.println(wordList.get(4)); //This gives, Error: 4 when running program (compiles fine) }
I was hoping some one could help me figure out where I am going wrong?
As far as I can see this should work fine?
Any ideas would be appreciated
Thanks,
Kriogenic.