I want to write integers (p.e a telephone number or ID) into a file. But
the method write() of FileWriter seems to support only char, not int.
What am I supposed to do?
Thanks.
Printable View
I want to write integers (p.e a telephone number or ID) into a file. But
the method write() of FileWriter seems to support only char, not int.
What am I supposed to do?
Thanks.
Actually write() method deals with Strings, or char buffer(actually array is the correct word in Java). So what you've to do is, convert the int into string and write it to the file. When you read and want to deal with them as numbers(int) convert back to int. That's all.