Imagine a command line copy program that you use like that:
copy <destination-dir> <source-file>
A simple implementation in Java would be (provided as a fragment):
package com.example;
import java.io.File;
public class Copy {
public static void main(String[] args) {
if (args.length != 2) {
exitWithErrorCode(); // to be implemented
}
File destinationDir = new File(args[0]);
File sourceFile = new File(args[1]);
copyFileToDir(sourceFile, destinationDir);
}
private static void copyFileToDir(File sourceFile, File destDir) {
// to be implemented
}
}
and you would call it like
java com.example.Copy /tmp /home/me/example.txt