title: How to access variables which are inside try-catch?
body: <p>Im doing something like</p>
  
  <pre><code>JSONArray json = uf.getAllRows();
  (int x = 0; x &lt;= json.length(); x++) {
  JSONObject jo = json.getJSONObject(x); //Eclipse is suggesting that use try-catch here.
  
  String name = jo.getString("username");
  mainll[x] = new LinearLayout(this);
  mainll[x].setId(x);
  mainll[x].setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,   LayoutParams.WRAP_CONTENT));
  mainll[x].setGravity(Gravity.CENTER);
  .
  .
  .
  .
  }
  </code></pre>
  
  <p>if i use try catch than "jo" is not recognized at the following line:</p>
  
  <pre><code>String name = jo.getString("username");
  </code></pre>
  
  <p>Can anyone please tell me how can i solve this problem?</p>