Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions

Question

What about leadership lessons from particularly good or bad bosses?

Answered: 1 week ago

Question

How would you assess the value of an approach like this?

Answered: 1 week ago

Question

When would you use one approach, and when would you use another?

Answered: 1 week ago