- How do you read/write a text file in Java?
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.
public static void main(String[] args) {
try {
FileWriter writer = new FileWriter(“MyFile.txt”, true);
writer.write(“Python is best programming language”);
writer.write(“\r\n”); // write new line
writer.write(“Java is also a good programming language!”);
writer.close();
System.out.println(“Success…”);
} catch (IOException e) {
e.printStackTrace();
}……………..
DO YOU WANT FULL ANSWER THEN TAP ON THE BELOW ATTACHMENT: