1.

How to copy the file from one location to other?(a) Files.copy(source, target)(b) Path.copy(source, target)(c) source.copy(target)(d) Files.createCopy(target)This question was addressed to me in an interview for internship.The above asked question is from File and Directory topic in section Autoboxing & Miscellaneous of Java

Answer»

Right answer is (a) Files.COPY(source, target)

The explanation is: Files.copy(source, target) is used to copy a file from one LOCATION to another. There are VARIOUS options available like REPLACE_EXISTING, COPY_ATTRIBUTES and NOFOLLOW_LINKS.



Discussion

No Comment Found

Related InterviewSolutions