|
Java™ by example!
|
|
|
How do I read data from a text file?
If you are reading a text file, you can use the FileReader class in the java.io package. Here's an example:
You will probably still see code around that uses the method readLine of the DataInputStream class. Sun has deprecated this method because it does not properly convert bytes (1 byte) to characters (2 bytes). Here's the code if you're still using 1.0.2:
Further Information
Author of answer: Joris Van den Bogaert
Comments
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|