The method length() is undefined for the type JSONArray
<p>Eclipse always gives me this compilation error when I try to get the length of a JSONArray:</p>

<blockquote>
  <p>the method length() is undefined for the type JSONArray</p>
</blockquote>

<p>Here is the code:</p>

<pre><code>import org.springframework.context.annotation.Scope;
import java.net.*;
import java.io.*;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JSONSerializer;
import javax.inject.Named;

@Named("search")
@Scope("request")

public class Search {

    private String query;
    private String result;
    private int num;


    public String getQuery() {
        return query;
      }
    public void setQuery(String query) {
        this.query = query;
      }
    public String getResult() {
        return this.result;
      }
    public void setResult(String result) {
        this.result = result;
      }
    public int getNum() {
        return this.num;
      }
    public void setNum(int num) {
        this.num = num;
      }


    public String send() {
         try 
        {
            //SEND REQUEST TO SOLR SERVER

            URL url = new URL("http://localhost:8983/solr/select/?q="+this.query +"&amp;version=2.2&amp;start=0&amp;rows=100&amp;indent=on&amp;wt=json");

            BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
            String str;

            while ((str = in.readLine()) != null) 
            {
                this.result = this.result+str;
            }

            in.close();

            //CONVERT RESULT TO OBJECT


           this.result=this.result.substring(4);
           JSONObject json = (JSONObject) JSONSerializer.toJSON(this.result);
           JSONArray results = new JSONArray();
            json = json.getJSONObject("response");
            this.num = json.getInt("numFound");

            results = json.getJSONArray("docs");
            int num = results.length();
</code></pre>

<p>I have no idea why this error is popping up. How is this caused and how can I solve it?</p>
