⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.java

📁 基于netbeans的java桌面应用程序合集
💻 JAVA
字号:
/*
 * Main.java
 *
 * Created on 2007年7月28日, 下午7:44
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package filetest;
import java.io.*;
//import java.io.File.*;
/**
 *
 * @author Administrator
 */
public class Main {
    
    /** Creates a new instance of Main */
    public Main() {
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
    File f=new File("D:\\1.txt");
    if(f.exists())
        f.delete();
    else
        try
        {
         f.createNewFile();
        }
        catch(Exception e)
        {
        System.out.println(e.getMessage());
        }
    System.out.println("File name : " + f.getName());
     System.out.println("File path: " + f.getPath());
      System.out.println("Abs path: " + f.getAbsolutePath());
       System.out.println("Parent: " + f.getParent());
        System.out.println(f.exists()?"exists":"does not exist");
        System.out.println(f.canWrite()?"is writeable":"is not writeable");
         System.out.println(f.canRead()?"is readable":"is not readable");
          System.out.println(f.isDirectory()?"is":"is not"+"a directory");
           System.out.println(f.isFile()?"is normal file":"might be a named pipe");
            System.out.println(f.isAbsolute()?"is absolute":"is not absolute");
    System.out.println("File last modified:"+f.lastModified());
     System.out.println("File size:"+f.length()+"Bytes");
    System.out.println(f.hashCode());
    }
    
}

⌨️ 快捷键说明

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