?? ch8ex2.java
字號:
import java.io.*;
import java.util.*;
import java.text.*;
public class ch8ex2{
public static void main(String[]args){
File f1=new File("ch8ex1.class");
if(f1.exists()){
//顯示文件屬性
String lo=f1.getAbsolutePath();
System.out.println("The location is :"+lo);
long len=f1.length();
System.out.println("Size is : "+len);
long mo=f1.lastModified();
Date d=new Date(mo);
DateFormat df=DateFormat.getDateTimeInstance(DateFormat.DEFAULT,DateFormat.DEFAULT);
String fDate=df.format(d);
System.out.println("Last Modified :"+fDate);
System.out.print("The attributes: ");
if(f1.canRead())
System.out.println(" can read");
if(f1.canWrite())
System.out.println(" can write");
if(f1.isHidden())
System.out.println(" is hidden");
//修改文件屬性
f1.setLastModified(mo+1000);
f1.setReadOnly();
}else
System.out.println("ch8ex1.class file is not exist");
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -