<pre><code> select sysdate from dual </code>becomes
<pre><code> String sql = "select sysdate "+ "from dual"; </code>Don’t forget the extra spaces! This is fine until your SQL statement becomes larger (which it will). While searching for a better way to handle this, I came upon the bug report at Sun for this issue. Here is Sun’s response to this issue:
This is yet another request for a syntactic sugar to save some user from typing. It’s not worth it.
Wow. Thanks for the understanding… No wonder people are looking for alternatives. Even Groovy supports Python-style multi-line strings! One possibility I found is Java+, a pre-processor. It integrates well with Ant and does its job, but source-code management becomes complicated—especially if you’re using an IDE.
If Sun finally broke down and added printf, the least it could do is consider adding multi-line strings.