Wednesday, March 16, 2016

Java Examples : How To Get File Separator Using System Class

Intro


This examples will demonstrates how to get file separator using System class. To get file separator, you can use System.getProperty() method with parameter "file.separator".

Examples


package com.freesamplecode.java.basic;

public class GetFileSeparatorDemo {
 public static void main(String[] args){
  String fileSeparator = System.getProperty("file.separator");
  System.out.println("File Separator : "+fileSeparator);
 }
}


Output


File Separator : \


Screenshot

How To Get File Separator Using System Class

Related Posts:

0 comments: