title: java (android) create JSONObject from scratch
body: <p>I'm trying to do something like:</p>
  
  <pre><code>public static final JSONObject MYOBJ = new JSONObject().put("value", "expression");
  </code></pre>
  
  <p>but eclipse get's mad and says there's an error on the line even though the tool tip shows <code>No solutions available</code></p>
  
  <p>I've tried changing <code>JSONObject</code> to type <code>String</code> and still the same prob. I'm shying away from hash maps and would really like to use JSON.</p>
  
  <p>** EDIT - code location **</p>
  
  <pre><code>package ...
  
  import ...
  
  public class MyActivity extends Activity {
      public static final JSONObject MYOBJ = new JSONObject().put("value", "expression");
  
      ... // onCreate etc
  }
  </code></pre>