The designers of this feature realized this requirement as well (see ‘New escape sequences’ in JEP368). So, with the latest early access build for JDK 14 you can use a trailing \
to escape the new line at the end of a line:
public class Main {
public static void main(String[] args) {
String paragraph =
"""
aaaa bbbb cccc \
dddd eeee ffff \
gggg hhhh iiii \
""";
System.out.println(paragraph);
}
}
Prints:
aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii