Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //write in file
- try {
- File myObj = new File("filename.txt");
- if (myObj.createNewFile()) {
- System.out.println("File created: " + myObj.getName());
- } else {
- System.out.println("File already exists.");
- }
- } catch (IOException e) {
- System.out.println("An error occurred.");
- e.printStackTrace();
- }
- //read from file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement