Java 7 - Multiline strings

Mike picture Mike · Jan 3, 2011 · Viewed 21.6k times · Source

I've read that multiline string literals were proposed to be added in Java 7.

Although I can't find any documentation saying definitely that they have been. I'd like to know if they are, because this is something I'd consider switching versions for.

Answer

João Silva picture João Silva · Jan 3, 2011

Multiline string literals are not going to be added to JDK 7. You can check Project Coin's homepage for a list of language changes.

However, you can use Scala, which does support multiline string literals using triple quotes:

var s = """Hello
      World"""