![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
Exception in thread "main" java.util.NoSuchElementExceptionhi this is my code.I am reading from a .csv which contains names in 1st row and 1st column and number in between. i am trying to read that into a two dimensional array but its thrwing this error.
Exception in thread "main" java.util.NoSuchElementException at java.util.StringTokenizer.nextToken(StringTokenize r.java:332) at readcsv.readCSV.main(readCSV.java:45) my codes is JAVA Code:
Last edited by LuciWiz : 20-Nov-2008 at 01:15.
Reason: Please insert your Java code between [java] & [/java] tags
|
|||
|
#2
|
||||
|
||||
Re: geetting this error Exception in thread "main" java.util.NoSuchElementExceptionOut of curiosity, what is your java version?
I get this compiling the code: Code:
Anyway, here's what the Java API says about DataInputStream's readline() call: Code:
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#3
|
||||
|
||||
Re: Exception in thread "main" java.util.NoSuchElementExceptionQuote:
If you happen to see the StringTokenizer Loop, you are using st.nextToken() two times.!!!!! That is the cause of the error. Whenever you call a nextToken() method, the tokenizer will automatically move on the next item. Here is an example: Suppose that your file has the following items: 1,2,3,4,5,6 When you try out your code, it will print 1, 3, 5, but actually, only 2, 4 and 6 are added to your data. The solution to your problem might be: JAVA Code:
__________________
Don't walk in front of me, I may not follow. Don't walk behind me, I may not lead. Just walk beside me and be my friend. |
|
#4
|
||||
|
||||
Re: Exception in thread "main" java.util.NoSuchElementExceptionThanks for pointing that out, Paramesh, I completely overlooked that double call!
![]() __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
Recent GIDBlog
Problems with the Navy (Officers) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Exception in thread "main" java.lang.NullPointerException | valley1girl | Java Forum | 12 | 18-Jun-2009 12:32 |
| Exception in thread "main" java.lang.NullPointerException | gedcraw555 | Java Forum | 3 | 25-Feb-2008 08:22 |
| Exception in thread "main" java.lang.NullPointerException | Magelloo | Java Forum | 3 | 05-May-2007 23:01 |
| Thread synchronization Assignment help!! | rossi143 | C Programming Language | 1 | 25-Mar-2007 20:10 |
| please help in solving: Exception in thread "main" java.lang.nullpointerexception | vkiran_v | Java Forum | 8 | 09-May-2006 07:06 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The