Get file separator using System class
- /*
- Get file separator using System class
- This example shows how to get the file separator using
- System class.
- */
- public class GetFileSeparator {
- public static void main(String[] args) {
- /*
- * Get file.separator system property using
- * public static String getProperty(String name) method of
- * System class.
- */
- String strFileSeparator = System.getProperty("file.separator");
- System.out.println("File separator is : " + strFileSeparator);
- }
- }
- /*
- Output would be system dependent. Typical output would be
- File separator is : \
- */



