了解File类

import java.io.*;
class FileTest
{
	public static void main(String argvs[]) throws IOException
	{
		File file = new File(".");
		System.out.println(file.getName());

		System.out.println(file.getAbsoluteFile().getParent());

		File newFile = new File("fuck");
		System.out.println(newFile.exists());
		newFile.createNewFile();

		String[] fileList = file.list();
		for(String fileName: fileList)
		{
			System.out.println(fileName);
		}
		System.out.println(newFile.exists());

	}
}

你可能感兴趣的:(类,安卓)