The only thing that's relevant here is that to write an actual '\' character inside a String in Java source code, you must double it:
args = "\\d";
The same goes for character constants:
char c = '\\';
There's no "escaping" of characters read from the command line or from files; a \ is just an ordinary character at runtime. Escaping is just used to turn off the special meaning of the \ character in source code.