How Working Directory and File seperator Works in Java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Anand;
import java.io.File;
/**
*
* @author Ananddw
*/
public class FileSep {
public static void main (String [] args){
// System.get property will give you Working Directory
String wrkDir=System.getProperty("user.dir");
//Print the working Directory
System.out.println("WrkDir===>"+wrkDir);
//Seperate file with "/" character.
System.out.println("File Seperator===>"+File.separator);
//seperate path with ":" Symbol
System.out.println("File pathSeparator===>"+File.pathSeparator);
//seperate file with "/" symbol
System.out.println("File pathSeparatorChar===>"+File.pathSeparatorChar);
//seperate file with ":" symbol
System.out.println("File separatorChar===>"+File.separatorChar);
}
}
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Anand;
import java.io.File;
/**
*
* @author Ananddw
*/
public class FileSep {
public static void main (String [] args){
// System.get property will give you Working Directory
String wrkDir=System.getProperty("user.dir");
//Print the working Directory
System.out.println("WrkDir===>"+wrkDir);
//Seperate file with "/" character.
System.out.println("File Seperator===>"+File.separator);
//seperate path with ":" Symbol
System.out.println("File pathSeparator===>"+File.pathSeparator);
//seperate file with "/" symbol
System.out.println("File pathSeparatorChar===>"+File.pathSeparatorChar);
//seperate file with ":" symbol
System.out.println("File separatorChar===>"+File.separatorChar);
}
}
Comments
Post a Comment