white a program in java which takes input from user and write on a story.txt file code example

Example: Write an application that reads the content of the current directory and prints it to the screen. java

package com.vogella.java.files;

import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {
  public static void main(String[] args) throws IOException {
    String input = FilesUtil.readTextFile("file.txt");
    System.out.println(input);
    FilesUtil.writeToTextFile("copy.txt", input);

    System.out.println(FilesUtil.readTextFile("copy.txt"));

    FilesUtil.readTextFileByLines("file.txt");
    Path path = Paths.get("file.txt");
  }
}