title: Why I cannot split string with $ in Java
body: <p>I was just doodling on <code>eclipse IDE</code> and written following code.</p>
  
  <pre><code>String str = new String("A$B$C$D");
  String arrStr[] = str.split("$");
  for (int i = 0; i &lt; arrStr.length; i++) {
      System.out.println("Val: "+arrStr[i]);
  }
  </code></pre>
  
  <p>I was expecting output like:
  Val: A
  Val: B
  Val: C
  Val: D<br>
  But instead of this, I got output as </p>
  
  <p><code>Val: A$B$C$D</code>
  Why? I am thinking may be its internally treated as a special input or may be its like variable declaration rules.</p>