Simple/Direct/Heredoc way of constructing a HTML string in Java

No, but some tools escape it for you when you paste it, like eclipse.


To echo benjismith's trick from a similar question, you can use an alternate character and replace them afterwards:

String myString = "using `backticks` instead of quotes".replace('`', '"');

I found it helpful when I was writing tests with JSON

String json = "{`kind`:`file`,`sid`:802,`rid`:5678 ,`attrs`:{`name`:`FILE-WG-2468`}}".replace('`', '"');
// vs
String json = "{\"kind\":\"file\",\"sid\":802,\"rid\":5678 ,\"attrs\":{\"name\":\"FILE-WG-2468\"}}";

It can't be done in Java like in Python. However if you are using Eclipse go to Window->Preferences->Java->Editor->Typing The last check box is "Escape text when pasting into a String literal". Check that. Now when you paste when your cursor is between quotation marks it'll be escaped.