writing to a text file java
PrintWriter writer = new PrintWriter("the-file-name.txt", "UTF-8");
writer.println("The first line");
writer.println("The second line");
writer.close();
writing to a text file java
PrintWriter writer = new PrintWriter("the-file-name.txt", "UTF-8");
writer.println("The first line");
writer.println("The second line");
writer.close();
How do you write or read data from or to file with Java?
Read data: I can use classes bufferedReader and bufferwriter.
Lets say I have a text in Java.
I use bufferedReader to read the files if it is a random file
bufferedReader is only the functionality to read a file.
For, Excel files I use the special library, Apache POI library.
These are external libraries.
I use properties class to read the properties files.
Scanner class also for read the data from files
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us