Reading and Writing to a .txt file in Java

后端 未结 4 547
[愿得一人]
[愿得一人] 2020-12-22 04:00

Here is my prompt for the assignment: Your program needs to read the information from a text file instead of using a scanner to read from command line. Your program also ne

4条回答
  •  攒了一身酷
    2020-12-22 04:50

        import java.nio.file.path;
        import java.nio.file.paths;
        class FileCopy {
        public static void main(String args[])
        {
        Path sour =Paths.get("Source path");
        Path dest =Paths.get("destination path"); // The new file name should be given  
    
        or else FileAlreadyExistsException occurs.                                            
    
        Files.copy(sour, dest);
        }
        }
    

提交回复
热议问题