\x Escape in Java?
Strings in Java are always encoded in UTF-16, so it uses a Unicode escape: \u0048
. Octal characters are supported as well: \110
Note that Unicode escapes are parsed quite early. It can come as a surprise when
String s = "text\u000d\u000a";
causes a compiler error because you should have used "text\015\012"
or "text\r\n"