Question: Which code, if inserted into the method, will cause it to correctly copy any file passed to it that is accessible? (Choose two.) void copyFile(String

Which code, if inserted into the method, will cause it to correctly copy any file passed to it that is accessible? (Choose two.) 

void copyFile(String source, String target) throws Exception { try (var is =

new FileInputStream (source); } } OutputStream os = new FileOutputStream (target)) {

void copyFile(String source, String target) throws Exception { try (var is = new FileInputStream (source); } } OutputStream os = new FileOutputStream (target)) { byte[] data new byte[123]; int chirps; // INSERT CODE HERE

Step by Step Solution

3.42 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To correctly copy a file in Java using byte streams we need to repeatedly read from the source file using FileInputStream and write to the target file ... View full answer

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 Oracle Questions!