An example on getting file separator thereby detecting the OS approximately. Single statement.
Note: The file separator depends upon your OS. If windows the above is the output, for linux like OS / is the file separator.
File Separator Example
import java.io.*;
class GetFileSeparator
{
public static void main(String args[])
{
System.out.println("The file separator is "+File.separatorChar);
}
}
Sample Output
The file separator is \
Note: The file separator depends upon your OS. If windows the above is the output, for linux like OS / is the file separator.
No comments:
Post a Comment