Question: java question. Write a method public static void copy(String infile, String outfile) that copies all bytes from one file to another, without using Files.copy. Using

java question. Write a method public static void copy(String infile, String outfile) that copies all bytes from one file to another, without using Files.copy. Using copydemo.java and london.txt provided to test.

import java.io.FileNotFoundException; import java.io.IOException; import java.util.Scanner; /** This program tests a method that copies all bytes from one file to another, without using Files.copy. */ //OUT londonOut.txt public class CopyDemo { public static void main(String[] args) { try { Scanner cin = new Scanner(System.in); System.out.print("Enter the name of the source file -> "); String infile = cin.next(); System.out.print("Enter the name of the destination file -> "); String outfile = cin.next(); copy(infile,outfile); } catch (IOException ex) { System.out.println(ex); } } /** Copies a source file to a destination file. @param infile the name of the input/source file @param outfile the name of the output/destination file @throws java.io.FileNotFoundException */ public static void copy(String infile, String outfile) throws FileNotFoundException, IOException { //complete this method } }

london.txt

London Bridge is falling down, Falling down, falling down, London Bridge is falling down, My fair Lady.

Build it up with wood and clay, Wood and clay, wood and clay, Build it up with wood and clay, My fair Lady

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!