Java Data Type How to - Escape string as directory name








Question

We would like to know how to escape string as directory name.

Answer

import java.io.File;
//w  ww .ja  v  a  2 s  . c om
public class Main {

  public static void main(String[] args) {
    File f = new File("c:\\MyFolder");
    System.out.println(f);

  }
}

The code above generates the following result.