Integer.parseInt problem....

package readtext;

import java.io.*;// For input & output classes

import java.util.Date;// For the Date class

publicclass create_table{

public create_table(){

}

publicstaticvoid main(String[] args)

throws IOException{

{

//Read from file

BufferedReader in =new BufferedReader(

new FileReader("C:/Documents and Settings/seng/Desktop/testfile/VehicleNode.txt"));

int out;

String text;

while((text = in.readLine()) !=null)

{

out = Integer.parseInt(text);

System.out.println(out);

}

in.close();

}

}

}

the compliar giving me tis running error....does any1 know how can i solve it?

java.lang.NumberFormatException: For input string:"3 10 3"

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)

at java.lang.Integer.parseInt(Integer.java:477)

at java.lang.Integer.parseInt(Integer.java:518)

at readtext.create_table.main(create_table.java:42)

Exception in thread"main"

Java Result: 1

[2047 byte] By [wilfrid100a] at [2007-10-3 2:51:40]
# 1
This is runtime exception. Not a compile issue.3 10 3 is not a an int it is a string with spaces between the numbers.
zadoka at 2007-7-14 20:40:34 > top of Java-index,Java Essentials,New To Java...
# 2

> the compliar giving me tis running error....does any1 know how can i solve it?

> java.lang.NumberFormatException: For input string: "3 10 3"

Well, three integers with spaces in between them certainly don't make

up a valid string representation of a single integer do they?

kind regards,

Jos

JosAHa at 2007-7-14 20:40:34 > top of Java-index,Java Essentials,New To Java...
# 3
how do i can read for the whole line?if i want to use an array to read for the whole information...is tat ok?example:int[ ] [ ] = new int [10] [3]int[0][0] = "3"int[0][1] = "10"int[0][2] = "3".................
wilfrid100a at 2007-7-14 20:40:34 > top of Java-index,Java Essentials,New To Java...
# 4
Have a look at the String.split() method and apply your originalcode to every element in the returned String[] array.kind regards,Jos
JosAHa at 2007-7-14 20:40:34 > top of Java-index,Java Essentials,New To Java...
# 5
And stop saying "tat" when you mean "that". If you're thinking it's whimsical....it isn't.
paulcwa at 2007-7-14 20:40:34 > top of Java-index,Java Essentials,New To Java...
# 6
thank's to correct my word, i will try to correct my spelling..
wilfrid100a at 2007-7-14 20:40:34 > top of Java-index,Java Essentials,New To Java...