//遍历获得所有盘符 File[] roots = File.listRoots(); for (int i =0; i < roots.length; i++) { System.out.println(roots[i]); } //获取最后一个盘符 File[] roots = File.listRoots(); String fileName = roots[roots.length-1].toString();
//遍历获得所有盘符 File[] roots = File.listRoots(); for (int i =0; i < roots.length; i++) { System.out.println(roots[i]); } //获取最后一个盘符 File[] roots = File.listRoots(); String fileName = roots[roots.length-1].toString();