File类
File f1 = new File("e:/谷歌下载/results-pr01.xls");
f1.isFile();
f1.isDirectory();
File f2 = new File("e:/谷歌下载/","test.txt");
try {
f2.createNewFile();<>如果文件不存在,创建路径后,还要用这个这个方法才可以创建<>
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
File f3 = new File("e:/谷歌下载/test/test2");
f3.mkdirs();<>用于创建文件夹,因为test文件夹不存在,所以先创建test父文件夹,再创建test2文件夹<>
f3.mkdir();<>同样创建文件夹,但因为test文件夹不存在,创建失败<>
Scanner类
Scanner s = new Scanner(System.in);
System.out.println("请出入你的年龄:");
int age = s.nextInt();
System.out.println("请输入你的姓名:");
String name = s.nextLine();