filedemo1.java

来自「JAVA程序设计课程中各章节的程序实例。」· Java 代码 · 共 19 行

JAVA
19
字号
/**Why the file always can't be created?Answer:you must create a file first then you can have the implementations 2004.11.19
*My first java file program
*2004.11.15. xhcprince
*/
import java.io.File;

class fileDemo1
{
	public static void main(String args[])
	{
		File test = new File("E:\\my.doc");

		System.out.println("File name: " + test.getName());
		System.out.println("File path: " + test.getPath());
		System.out.println("File exist? " + test.exists());
		System.out.println("File size: " + test.length());
		System.out.println("File last modified: " + test.lastModified());
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?