title: Defining String with the char '{' in JAVA
body: <p>I'm trying to define a Constant with some pattern identifier to be able to replace it in large String constructs later, for example in a complex Querie.</p>
  
  <pre><code>private static String SUBSTITUTE_1 = "${substitute1}";
  </code></pre>
  
  <p>But when I do that, compiler complains about expecting a number next to the '{' char.</p>
  
  <p>My question is: Is there a way to escape the special characters in the string?</p>
  
  <pre><code>private static String SUBSTITUTE_1 = "\$\{substitute1\}";
  </code></pre>
  
  <p>This does not work.</p>
  
  <p>This is strange because if I define a String builder like so</p>
  
  <pre><code>private static String SUBSTITUTE_1 = new StringBuilder("${substitute1}").toString();
  </code></pre>
  
  <p>there no problem with the special characters.</p>
  
  <p>Unless there is something really obvious that i'm missing this does not make sense.</p>
  
  <p>Thanks in advance.</p>