import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
//Files class is available from 1.7
public class UsingFilesClass {
public static void main(String args[]) {
String data = "SOME DATA";
try {
Files.write(Paths.get("d:/java1.txt"), data.getBytes());
System.out.println("Done");
} catch (IOException e) {
e.printStackTrace();
}
}
}
import java.nio.file.Files;
import java.nio.file.Paths;
//Files class is available from 1.7
public class UsingFilesClass {
public static void main(String args[]) {
String data = "SOME DATA";
try {
Files.write(Paths.get("d:/java1.txt"), data.getBytes());
System.out.println("Done");
} catch (IOException e) {
e.printStackTrace();
}
}
}
No comments:
Post a Comment