●ファイル名とパスを取得

getName()
getParent()
getPath()
getAbsolutePath()
getCanonicalPath()


--------------------------------------------------------------------------------

import java.io.*;
class FileDemo1 {
public static void main(String args[]){
try{

//定数を表示
System.out.println("pathSeparatorChar = " + File.pathSeparatorChar);
System.out.println("separetorChar = " + File.separatorChar);

//
File file = new File("C:\\WINDOWS\\system32\\win.com");
System.out.println("ファイル名:" + file.getName());
System.out.println("親パス  :" + file.getParent());
System.out.println("パス   :" + file.getPath());
System.out.println("絶対パス :" + file.getAbsolutePath());
System.out.println("標準パス :" + file.getCanonicalPath());
}
catch(Exception e){
e.printStackTrace();
}
}
}
--------------------------------------------------------------------------------