Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Display path separator in Java
To display the path separator, use the Properties class and import the following package −
import java.util.Properties;
Use the getProperties() method first and create an object −
Properties p = System.getProperties();
Now, set the key for path separator −
p.getProperty("path.separator")
The following is an example −
Example
import java.util.Properties;
public class Demo {
public static void main(String[] args) {
Properties p = System.getProperties();
System.out.println("Separator is "+p.getProperty("path.separator"));
}
}
Output
Separator is :
Advertisements
