测试给定文件是否位于给定目录内。
/**来自 时 代 J a v a - nowjava.com**/ //package com.nowjava; import java.io.File; import java.io.IOException; public class Main { public static void main(String[] argv) throws Exception { File file = new File("Main.java"); File dir = new File("Main.java"); System.out.println(isLocatedInside(file, dir)); } /** * Test if a given file is located inside the given directory. * * @param file * @param dir * @return * @throws IOException */ public static boolean isLocatedInside(File file, File dir)