Advertisement
Guest User

h

a guest
Jan 24th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1.  
  2. Consider the following code: //Assume appropriate imports public class FileCopier { public static void copy(String records1, String records2) throws IOException { try ( InputStream is = new FileInputStream(records1); OutputStream os = new FileOutputStream(records2);) { byte[] buffer = new byte[1024]; int bytesRead = 0; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } } catch (FileNotFoundException | java.io.InvalidClassException e) { e.printStackTrace(); } } public static void main(String[] args) throws Exception { copy("c:\\temp\\test1.txt", "c:\\temp\\test2.txt"); } } Given that test1.txt exists but test2.txt does not exist, what will happen when the above program is compiled and run?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement